repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wildfly/wildfly-core | deployment-scanner/src/main/java/org/jboss/as/server/deployment/scanner/DeploymentScannerService.java | DeploymentScannerService.addService | public static ServiceController<DeploymentScanner> addService(final OperationContext context, final PathAddress resourceAddress, final String relativeTo, final String path,
final int scanInterval, TimeUnit unit, final boolean autoDeployZip,
final boolean autoDeployExploded, final boolean autoDeployXml, final boolean scanEnabled, final long deploymentTimeout, boolean rollbackOnRuntimeFailure,
final FileSystemDeploymentService bootTimeService, final ScheduledExecutorService scheduledExecutorService) {
final DeploymentScannerService service = new DeploymentScannerService(resourceAddress, relativeTo, path, scanInterval, unit, autoDeployZip,
autoDeployExploded, autoDeployXml, scanEnabled, deploymentTimeout, rollbackOnRuntimeFailure, bootTimeService);
final ServiceName serviceName = getServiceName(resourceAddress.getLastElement().getValue());
service.scheduledExecutorValue.inject(scheduledExecutorService);
final ServiceBuilder<DeploymentScanner> sb = context.getServiceTarget().addService(serviceName, service);
sb.addDependency(context.getCapabilityServiceName(PATH_MANAGER_CAPABILITY, PathManager.class), PathManager.class, service.pathManagerValue);
sb.addDependency(context.getCapabilityServiceName("org.wildfly.management.notification-handler-registry", null),
NotificationHandlerRegistry.class, service.notificationRegistryValue);
sb.addDependency(context.getCapabilityServiceName("org.wildfly.management.model-controller-client-factory", null),
ModelControllerClientFactory.class, service.clientFactoryValue);
sb.requires(org.jboss.as.server.deployment.Services.JBOSS_DEPLOYMENT_CHAINS);
sb.addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.controlledProcessStateServiceValue);
return sb.install();
} | java | public static ServiceController<DeploymentScanner> addService(final OperationContext context, final PathAddress resourceAddress, final String relativeTo, final String path,
final int scanInterval, TimeUnit unit, final boolean autoDeployZip,
final boolean autoDeployExploded, final boolean autoDeployXml, final boolean scanEnabled, final long deploymentTimeout, boolean rollbackOnRuntimeFailure,
final FileSystemDeploymentService bootTimeService, final ScheduledExecutorService scheduledExecutorService) {
final DeploymentScannerService service = new DeploymentScannerService(resourceAddress, relativeTo, path, scanInterval, unit, autoDeployZip,
autoDeployExploded, autoDeployXml, scanEnabled, deploymentTimeout, rollbackOnRuntimeFailure, bootTimeService);
final ServiceName serviceName = getServiceName(resourceAddress.getLastElement().getValue());
service.scheduledExecutorValue.inject(scheduledExecutorService);
final ServiceBuilder<DeploymentScanner> sb = context.getServiceTarget().addService(serviceName, service);
sb.addDependency(context.getCapabilityServiceName(PATH_MANAGER_CAPABILITY, PathManager.class), PathManager.class, service.pathManagerValue);
sb.addDependency(context.getCapabilityServiceName("org.wildfly.management.notification-handler-registry", null),
NotificationHandlerRegistry.class, service.notificationRegistryValue);
sb.addDependency(context.getCapabilityServiceName("org.wildfly.management.model-controller-client-factory", null),
ModelControllerClientFactory.class, service.clientFactoryValue);
sb.requires(org.jboss.as.server.deployment.Services.JBOSS_DEPLOYMENT_CHAINS);
sb.addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.controlledProcessStateServiceValue);
return sb.install();
} | [
"public",
"static",
"ServiceController",
"<",
"DeploymentScanner",
">",
"addService",
"(",
"final",
"OperationContext",
"context",
",",
"final",
"PathAddress",
"resourceAddress",
",",
"final",
"String",
"relativeTo",
",",
"final",
"String",
"path",
",",
"final",
"in... | Add the deployment scanner service to a batch.
@param context context for the operation that is adding this service
@param resourceAddress the address of the resource that manages the service
@param relativeTo the relative to
@param path the path
@param scanInterval the scan interval
@param unit the unit of {@code scanInterval}
@param autoDeployZip whether zipped content should be auto-deployed
@param autoDeployExploded whether exploded content should be auto-deployed
@param autoDeployXml whether xml content should be auto-deployed
@param scanEnabled scan enabled
@param deploymentTimeout the deployment timeout
@param rollbackOnRuntimeFailure rollback on runtime failures
@param bootTimeService the deployment scanner used in the boot time scan
@param scheduledExecutorService executor to use for asynchronous tasks
@return the controller for the deployment scanner service | [
"Add",
"the",
"deployment",
"scanner",
"service",
"to",
"a",
"batch",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-scanner/src/main/java/org/jboss/as/server/deployment/scanner/DeploymentScannerService.java#L129-L146 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/ManagementModel.java | ManagementModel.findNode | public ManagementModelNode findNode(String address) {
ManagementModelNode root = (ManagementModelNode)tree.getModel().getRoot();
Enumeration<javax.swing.tree.TreeNode> allNodes = root.depthFirstEnumeration();
while (allNodes.hasMoreElements()) {
ManagementModelNode node = (ManagementModelNode)allNodes.nextElement();
if (node.addressPath().equals(address)) return node;
}
return null;
} | java | public ManagementModelNode findNode(String address) {
ManagementModelNode root = (ManagementModelNode)tree.getModel().getRoot();
Enumeration<javax.swing.tree.TreeNode> allNodes = root.depthFirstEnumeration();
while (allNodes.hasMoreElements()) {
ManagementModelNode node = (ManagementModelNode)allNodes.nextElement();
if (node.addressPath().equals(address)) return node;
}
return null;
} | [
"public",
"ManagementModelNode",
"findNode",
"(",
"String",
"address",
")",
"{",
"ManagementModelNode",
"root",
"=",
"(",
"ManagementModelNode",
")",
"tree",
".",
"getModel",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"Enumeration",
"<",
"javax",
".",
"swing",
... | Find a node in the tree. The node must be "visible" to be found.
@param address The full address of the node matching ManagementModelNode.addressPath()
@return The node, or null if not found. | [
"Find",
"a",
"node",
"in",
"the",
"tree",
".",
"The",
"node",
"must",
"be",
"visible",
"to",
"be",
"found",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/ManagementModel.java#L83-L92 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/ManagementModel.java | ManagementModel.getSelectedNode | public ManagementModelNode getSelectedNode() {
if (tree.getSelectionPath() == null) return null;
return (ManagementModelNode)tree.getSelectionPath().getLastPathComponent();
} | java | public ManagementModelNode getSelectedNode() {
if (tree.getSelectionPath() == null) return null;
return (ManagementModelNode)tree.getSelectionPath().getLastPathComponent();
} | [
"public",
"ManagementModelNode",
"getSelectedNode",
"(",
")",
"{",
"if",
"(",
"tree",
".",
"getSelectionPath",
"(",
")",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"ManagementModelNode",
")",
"tree",
".",
"getSelectionPath",
"(",
")",
".",
"get... | Get the node that has been selected by the user, or null if
nothing is selected.
@return The node or <code>null</code> | [
"Get",
"the",
"node",
"that",
"has",
"been",
"selected",
"by",
"the",
"user",
"or",
"null",
"if",
"nothing",
"is",
"selected",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/ManagementModel.java#L134-L137 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionUtils.java | ProtocolConnectionUtils.connectSync | public static Connection connectSync(final ProtocolConnectionConfiguration configuration) throws IOException {
long timeoutMillis = configuration.getConnectionTimeout();
CallbackHandler handler = configuration.getCallbackHandler();
final CallbackHandler actualHandler;
ProtocolTimeoutHandler timeoutHandler = configuration.getTimeoutHandler();
// Note: If a client supplies a ProtocolTimeoutHandler it is taking on full responsibility for timeout management.
if (timeoutHandler == null) {
GeneralTimeoutHandler defaultTimeoutHandler = new GeneralTimeoutHandler();
// No point wrapping our AnonymousCallbackHandler.
actualHandler = handler != null ? new WrapperCallbackHandler(defaultTimeoutHandler, handler) : null;
timeoutHandler = defaultTimeoutHandler;
} else {
actualHandler = handler;
}
final IoFuture<Connection> future = connect(actualHandler, configuration);
IoFuture.Status status = timeoutHandler.await(future, timeoutMillis);
if (status == IoFuture.Status.DONE) {
return future.get();
}
if (status == IoFuture.Status.FAILED) {
throw ProtocolLogger.ROOT_LOGGER.failedToConnect(configuration.getUri(), future.getException());
}
throw ProtocolLogger.ROOT_LOGGER.couldNotConnect(configuration.getUri());
} | java | public static Connection connectSync(final ProtocolConnectionConfiguration configuration) throws IOException {
long timeoutMillis = configuration.getConnectionTimeout();
CallbackHandler handler = configuration.getCallbackHandler();
final CallbackHandler actualHandler;
ProtocolTimeoutHandler timeoutHandler = configuration.getTimeoutHandler();
// Note: If a client supplies a ProtocolTimeoutHandler it is taking on full responsibility for timeout management.
if (timeoutHandler == null) {
GeneralTimeoutHandler defaultTimeoutHandler = new GeneralTimeoutHandler();
// No point wrapping our AnonymousCallbackHandler.
actualHandler = handler != null ? new WrapperCallbackHandler(defaultTimeoutHandler, handler) : null;
timeoutHandler = defaultTimeoutHandler;
} else {
actualHandler = handler;
}
final IoFuture<Connection> future = connect(actualHandler, configuration);
IoFuture.Status status = timeoutHandler.await(future, timeoutMillis);
if (status == IoFuture.Status.DONE) {
return future.get();
}
if (status == IoFuture.Status.FAILED) {
throw ProtocolLogger.ROOT_LOGGER.failedToConnect(configuration.getUri(), future.getException());
}
throw ProtocolLogger.ROOT_LOGGER.couldNotConnect(configuration.getUri());
} | [
"public",
"static",
"Connection",
"connectSync",
"(",
"final",
"ProtocolConnectionConfiguration",
"configuration",
")",
"throws",
"IOException",
"{",
"long",
"timeoutMillis",
"=",
"configuration",
".",
"getConnectionTimeout",
"(",
")",
";",
"CallbackHandler",
"handler",
... | Connect sync.
@param configuration the protocol configuration
@return the connection
@throws IOException | [
"Connect",
"sync",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionUtils.java#L105-L131 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/ReadlineConsole.java | CLITerminalConnection.openBlockingInterruptable | public void openBlockingInterruptable()
throws InterruptedException {
// We need to thread this call in order to interrupt it (when Ctrl-C occurs).
connectionThread = new Thread(() -> {
// This thread can't be interrupted from another thread.
// Will stay alive until System.exit is called.
Thread thr = new Thread(() -> super.openBlocking(),
"CLI Terminal Connection (uninterruptable)");
thr.start();
try {
thr.join();
} catch (InterruptedException ex) {
// XXX OK, interrupted, just leaving.
}
}, "CLI Terminal Connection (interruptable)");
connectionThread.start();
connectionThread.join();
} | java | public void openBlockingInterruptable()
throws InterruptedException {
// We need to thread this call in order to interrupt it (when Ctrl-C occurs).
connectionThread = new Thread(() -> {
// This thread can't be interrupted from another thread.
// Will stay alive until System.exit is called.
Thread thr = new Thread(() -> super.openBlocking(),
"CLI Terminal Connection (uninterruptable)");
thr.start();
try {
thr.join();
} catch (InterruptedException ex) {
// XXX OK, interrupted, just leaving.
}
}, "CLI Terminal Connection (interruptable)");
connectionThread.start();
connectionThread.join();
} | [
"public",
"void",
"openBlockingInterruptable",
"(",
")",
"throws",
"InterruptedException",
"{",
"// We need to thread this call in order to interrupt it (when Ctrl-C occurs).",
"connectionThread",
"=",
"new",
"Thread",
"(",
"(",
")",
"->",
"{",
"// This thread can't be interrupte... | Required to close the connection reading on the terminal, otherwise
it can't be interrupted.
@throws InterruptedException | [
"Required",
"to",
"close",
"the",
"connection",
"reading",
"on",
"the",
"terminal",
"otherwise",
"it",
"can",
"t",
"be",
"interrupted",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/ReadlineConsole.java#L186-L203 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementProtocolHeader.java | ManagementProtocolHeader.validateSignature | protected static void validateSignature(final DataInput input) throws IOException {
final byte[] signatureBytes = new byte[4];
input.readFully(signatureBytes);
if (!Arrays.equals(ManagementProtocol.SIGNATURE, signatureBytes)) {
throw ProtocolLogger.ROOT_LOGGER.invalidSignature(Arrays.toString(signatureBytes));
}
} | java | protected static void validateSignature(final DataInput input) throws IOException {
final byte[] signatureBytes = new byte[4];
input.readFully(signatureBytes);
if (!Arrays.equals(ManagementProtocol.SIGNATURE, signatureBytes)) {
throw ProtocolLogger.ROOT_LOGGER.invalidSignature(Arrays.toString(signatureBytes));
}
} | [
"protected",
"static",
"void",
"validateSignature",
"(",
"final",
"DataInput",
"input",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"signatureBytes",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"input",
".",
"readFully",
"(",
"signatureBytes",
... | Validate the header signature.
@param input The input to read the signature from
@throws IOException If any read problems occur | [
"Validate",
"the",
"header",
"signature",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementProtocolHeader.java#L90-L96 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementProtocolHeader.java | ManagementProtocolHeader.parse | public static ManagementProtocolHeader parse(DataInput input) throws IOException {
validateSignature(input);
expectHeader(input, ManagementProtocol.VERSION_FIELD);
int version = input.readInt();
expectHeader(input, ManagementProtocol.TYPE);
byte type = input.readByte();
switch (type) {
case ManagementProtocol.TYPE_REQUEST:
return new ManagementRequestHeader(version, input);
case ManagementProtocol.TYPE_RESPONSE:
return new ManagementResponseHeader(version, input);
case ManagementProtocol.TYPE_BYE_BYE:
return new ManagementByeByeHeader(version);
case ManagementProtocol.TYPE_PING:
return new ManagementPingHeader(version);
case ManagementProtocol.TYPE_PONG:
return new ManagementPongHeader(version);
default:
throw ProtocolLogger.ROOT_LOGGER.invalidType("0x" + Integer.toHexString(type));
}
} | java | public static ManagementProtocolHeader parse(DataInput input) throws IOException {
validateSignature(input);
expectHeader(input, ManagementProtocol.VERSION_FIELD);
int version = input.readInt();
expectHeader(input, ManagementProtocol.TYPE);
byte type = input.readByte();
switch (type) {
case ManagementProtocol.TYPE_REQUEST:
return new ManagementRequestHeader(version, input);
case ManagementProtocol.TYPE_RESPONSE:
return new ManagementResponseHeader(version, input);
case ManagementProtocol.TYPE_BYE_BYE:
return new ManagementByeByeHeader(version);
case ManagementProtocol.TYPE_PING:
return new ManagementPingHeader(version);
case ManagementProtocol.TYPE_PONG:
return new ManagementPongHeader(version);
default:
throw ProtocolLogger.ROOT_LOGGER.invalidType("0x" + Integer.toHexString(type));
}
} | [
"public",
"static",
"ManagementProtocolHeader",
"parse",
"(",
"DataInput",
"input",
")",
"throws",
"IOException",
"{",
"validateSignature",
"(",
"input",
")",
";",
"expectHeader",
"(",
"input",
",",
"ManagementProtocol",
".",
"VERSION_FIELD",
")",
";",
"int",
"ver... | Parses the input stream to read the header
@param input data input to read from
@return the parsed protocol header
@throws IOException | [
"Parses",
"the",
"input",
"stream",
"to",
"read",
"the",
"header"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementProtocolHeader.java#L109-L129 | train |
wildfly/wildfly-core | domain-management/src/main/java/org/jboss/as/domain/management/security/password/simple/SimplePasswordStrengthChecker.java | SimplePasswordStrengthChecker.checkConsecutiveAlpha | protected void checkConsecutiveAlpha() {
Pattern symbolsPatter = Pattern.compile(REGEX_ALPHA_UC + "+");
Matcher matcher = symbolsPatter.matcher(this.password);
int met = 0;
while (matcher.find()) {
int start = matcher.start();
int end = matcher.end();
if (start == end) {
continue;
}
int diff = end - start;
if (diff >= 3) {
met += diff;
}
}
this.result.negative(met * CONSECUTIVE_ALPHA_WEIGHT);
// alpha lower case
symbolsPatter = Pattern.compile(REGEX_ALPHA_LC + "+");
matcher = symbolsPatter.matcher(this.password);
met = 0;
while (matcher.find()) {
int start = matcher.start();
int end = matcher.end();
if (start == end) {
continue;
}
int diff = end - start;
if (diff >= 3) {
met += diff;
}
}
this.result.negative(met * CONSECUTIVE_ALPHA_WEIGHT);
} | java | protected void checkConsecutiveAlpha() {
Pattern symbolsPatter = Pattern.compile(REGEX_ALPHA_UC + "+");
Matcher matcher = symbolsPatter.matcher(this.password);
int met = 0;
while (matcher.find()) {
int start = matcher.start();
int end = matcher.end();
if (start == end) {
continue;
}
int diff = end - start;
if (diff >= 3) {
met += diff;
}
}
this.result.negative(met * CONSECUTIVE_ALPHA_WEIGHT);
// alpha lower case
symbolsPatter = Pattern.compile(REGEX_ALPHA_LC + "+");
matcher = symbolsPatter.matcher(this.password);
met = 0;
while (matcher.find()) {
int start = matcher.start();
int end = matcher.end();
if (start == end) {
continue;
}
int diff = end - start;
if (diff >= 3) {
met += diff;
}
}
this.result.negative(met * CONSECUTIVE_ALPHA_WEIGHT);
} | [
"protected",
"void",
"checkConsecutiveAlpha",
"(",
")",
"{",
"Pattern",
"symbolsPatter",
"=",
"Pattern",
".",
"compile",
"(",
"REGEX_ALPHA_UC",
"+",
"\"+\"",
")",
";",
"Matcher",
"matcher",
"=",
"symbolsPatter",
".",
"matcher",
"(",
"this",
".",
"password",
")... | those could be incorporated with above, but that would blurry everything. | [
"those",
"could",
"be",
"incorporated",
"with",
"above",
"but",
"that",
"would",
"blurry",
"everything",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/password/simple/SimplePasswordStrengthChecker.java#L289-L328 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServerOperationsFactory.java | ManagedServerOperationsFactory.createBootUpdates | public static ModelNode createBootUpdates(final String serverName, final ModelNode domainModel, final ModelNode hostModel,
final DomainController domainController, final ExpressionResolver expressionResolver) {
final ManagedServerOperationsFactory factory = new ManagedServerOperationsFactory(serverName, domainModel,
hostModel, domainController, expressionResolver);
return factory.getBootUpdates();
} | java | public static ModelNode createBootUpdates(final String serverName, final ModelNode domainModel, final ModelNode hostModel,
final DomainController domainController, final ExpressionResolver expressionResolver) {
final ManagedServerOperationsFactory factory = new ManagedServerOperationsFactory(serverName, domainModel,
hostModel, domainController, expressionResolver);
return factory.getBootUpdates();
} | [
"public",
"static",
"ModelNode",
"createBootUpdates",
"(",
"final",
"String",
"serverName",
",",
"final",
"ModelNode",
"domainModel",
",",
"final",
"ModelNode",
"hostModel",
",",
"final",
"DomainController",
"domainController",
",",
"final",
"ExpressionResolver",
"expre... | Create a list of operations required to a boot a managed server.
@param serverName the server name
@param domainModel the complete domain model
@param hostModel the local host model
@param domainController the domain controller
@return the list of boot operations | [
"Create",
"a",
"list",
"of",
"operations",
"required",
"to",
"a",
"boot",
"a",
"managed",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServerOperationsFactory.java#L180-L187 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/HostServerGroupTracker.java | HostServerGroupTracker.getMappableDomainEffect | private synchronized HostServerGroupEffect getMappableDomainEffect(PathAddress address, String key,
Map<String, Set<String>> map, Resource root) {
if (requiresMapping) {
map(root);
requiresMapping = false;
}
Set<String> mapped = map.get(key);
return mapped != null ? HostServerGroupEffect.forDomain(address, mapped)
: HostServerGroupEffect.forUnassignedDomain(address);
} | java | private synchronized HostServerGroupEffect getMappableDomainEffect(PathAddress address, String key,
Map<String, Set<String>> map, Resource root) {
if (requiresMapping) {
map(root);
requiresMapping = false;
}
Set<String> mapped = map.get(key);
return mapped != null ? HostServerGroupEffect.forDomain(address, mapped)
: HostServerGroupEffect.forUnassignedDomain(address);
} | [
"private",
"synchronized",
"HostServerGroupEffect",
"getMappableDomainEffect",
"(",
"PathAddress",
"address",
",",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"map",
",",
"Resource",
"root",
")",
"{",
"if",
"(",
"requiresMa... | Creates an appropriate HSGE for a domain-wide resource of a type that is mappable to server groups | [
"Creates",
"an",
"appropriate",
"HSGE",
"for",
"a",
"domain",
"-",
"wide",
"resource",
"of",
"a",
"type",
"that",
"is",
"mappable",
"to",
"server",
"groups"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/HostServerGroupTracker.java#L302-L311 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/HostServerGroupTracker.java | HostServerGroupTracker.getHostEffect | private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root) {
if (requiresMapping) {
map(root);
requiresMapping = false;
}
Set<String> mapped = hostsToGroups.get(host);
if (mapped == null) {
// Unassigned host. Treat like an unassigned profile or socket-binding-group;
// i.e. available to all server group scoped roles.
// Except -- WFLY-2085 -- the master HC is not open to all s-g-s-rs
Resource hostResource = root.getChild(PathElement.pathElement(HOST, host));
if (hostResource != null) {
ModelNode dcModel = hostResource.getModel().get(DOMAIN_CONTROLLER);
if (!dcModel.hasDefined(REMOTE)) {
mapped = Collections.emptySet(); // prevents returning HostServerGroupEffect.forUnassignedHost(address, host)
}
}
}
return mapped == null ? HostServerGroupEffect.forUnassignedHost(address, host)
: HostServerGroupEffect.forMappedHost(address, mapped, host);
} | java | private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root) {
if (requiresMapping) {
map(root);
requiresMapping = false;
}
Set<String> mapped = hostsToGroups.get(host);
if (mapped == null) {
// Unassigned host. Treat like an unassigned profile or socket-binding-group;
// i.e. available to all server group scoped roles.
// Except -- WFLY-2085 -- the master HC is not open to all s-g-s-rs
Resource hostResource = root.getChild(PathElement.pathElement(HOST, host));
if (hostResource != null) {
ModelNode dcModel = hostResource.getModel().get(DOMAIN_CONTROLLER);
if (!dcModel.hasDefined(REMOTE)) {
mapped = Collections.emptySet(); // prevents returning HostServerGroupEffect.forUnassignedHost(address, host)
}
}
}
return mapped == null ? HostServerGroupEffect.forUnassignedHost(address, host)
: HostServerGroupEffect.forMappedHost(address, mapped, host);
} | [
"private",
"synchronized",
"HostServerGroupEffect",
"getHostEffect",
"(",
"PathAddress",
"address",
",",
"String",
"host",
",",
"Resource",
"root",
")",
"{",
"if",
"(",
"requiresMapping",
")",
"{",
"map",
"(",
"root",
")",
";",
"requiresMapping",
"=",
"false",
... | Creates an appropriate HSGE for resources in the host tree, excluding the server and server-config subtrees | [
"Creates",
"an",
"appropriate",
"HSGE",
"for",
"resources",
"in",
"the",
"host",
"tree",
"excluding",
"the",
"server",
"and",
"server",
"-",
"config",
"subtrees"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/HostServerGroupTracker.java#L314-L335 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/HostServerGroupTracker.java | HostServerGroupTracker.map | private void map(Resource root) {
for (Resource.ResourceEntry serverGroup : root.getChildren(SERVER_GROUP)) {
String serverGroupName = serverGroup.getName();
ModelNode serverGroupModel = serverGroup.getModel();
String profile = serverGroupModel.require(PROFILE).asString();
store(serverGroupName, profile, profilesToGroups);
String socketBindingGroup = serverGroupModel.require(SOCKET_BINDING_GROUP).asString();
store(serverGroupName, socketBindingGroup, socketsToGroups);
for (Resource.ResourceEntry deployment : serverGroup.getChildren(DEPLOYMENT)) {
store(serverGroupName, deployment.getName(), deploymentsToGroups);
}
for (Resource.ResourceEntry overlay : serverGroup.getChildren(DEPLOYMENT_OVERLAY)) {
store(serverGroupName, overlay.getName(), overlaysToGroups);
}
}
for (Resource.ResourceEntry host : root.getChildren(HOST)) {
String hostName = host.getPathElement().getValue();
for (Resource.ResourceEntry serverConfig : host.getChildren(SERVER_CONFIG)) {
ModelNode serverConfigModel = serverConfig.getModel();
String serverGroupName = serverConfigModel.require(GROUP).asString();
store(serverGroupName, hostName, hostsToGroups);
}
}
} | java | private void map(Resource root) {
for (Resource.ResourceEntry serverGroup : root.getChildren(SERVER_GROUP)) {
String serverGroupName = serverGroup.getName();
ModelNode serverGroupModel = serverGroup.getModel();
String profile = serverGroupModel.require(PROFILE).asString();
store(serverGroupName, profile, profilesToGroups);
String socketBindingGroup = serverGroupModel.require(SOCKET_BINDING_GROUP).asString();
store(serverGroupName, socketBindingGroup, socketsToGroups);
for (Resource.ResourceEntry deployment : serverGroup.getChildren(DEPLOYMENT)) {
store(serverGroupName, deployment.getName(), deploymentsToGroups);
}
for (Resource.ResourceEntry overlay : serverGroup.getChildren(DEPLOYMENT_OVERLAY)) {
store(serverGroupName, overlay.getName(), overlaysToGroups);
}
}
for (Resource.ResourceEntry host : root.getChildren(HOST)) {
String hostName = host.getPathElement().getValue();
for (Resource.ResourceEntry serverConfig : host.getChildren(SERVER_CONFIG)) {
ModelNode serverConfigModel = serverConfig.getModel();
String serverGroupName = serverConfigModel.require(GROUP).asString();
store(serverGroupName, hostName, hostsToGroups);
}
}
} | [
"private",
"void",
"map",
"(",
"Resource",
"root",
")",
"{",
"for",
"(",
"Resource",
".",
"ResourceEntry",
"serverGroup",
":",
"root",
".",
"getChildren",
"(",
"SERVER_GROUP",
")",
")",
"{",
"String",
"serverGroupName",
"=",
"serverGroup",
".",
"getName",
"(... | Only call with monitor for 'this' held | [
"Only",
"call",
"with",
"monitor",
"for",
"this",
"held"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/HostServerGroupTracker.java#L338-L366 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/registry/LegacyResourceDefinition.java | LegacyResourceDefinition.registerAttributes | @Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
for (AttributeAccess attr : attributes.values()) {
resourceRegistration.registerReadOnlyAttribute(attr.getAttributeDefinition(), null);
}
} | java | @Override
public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
for (AttributeAccess attr : attributes.values()) {
resourceRegistration.registerReadOnlyAttribute(attr.getAttributeDefinition(), null);
}
} | [
"@",
"Override",
"public",
"void",
"registerAttributes",
"(",
"ManagementResourceRegistration",
"resourceRegistration",
")",
"{",
"for",
"(",
"AttributeAccess",
"attr",
":",
"attributes",
".",
"values",
"(",
")",
")",
"{",
"resourceRegistration",
".",
"registerReadOnl... | Register operations associated with this resource.
@param resourceRegistration a {@link org.jboss.as.controller.registry.ManagementResourceRegistration} created from this definition | [
"Register",
"operations",
"associated",
"with",
"this",
"resource",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/LegacyResourceDefinition.java#L135-L140 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/registry/LegacyResourceDefinition.java | LegacyResourceDefinition.registerChildren | @Override
public void registerChildren(ManagementResourceRegistration resourceRegistration) {
// Register wildcard children last to prevent duplicate registration errors when override definitions exist
for (ResourceDefinition rd : singletonChildren) {
resourceRegistration.registerSubModel(rd);
}
for (ResourceDefinition rd : wildcardChildren) {
resourceRegistration.registerSubModel(rd);
}
} | java | @Override
public void registerChildren(ManagementResourceRegistration resourceRegistration) {
// Register wildcard children last to prevent duplicate registration errors when override definitions exist
for (ResourceDefinition rd : singletonChildren) {
resourceRegistration.registerSubModel(rd);
}
for (ResourceDefinition rd : wildcardChildren) {
resourceRegistration.registerSubModel(rd);
}
} | [
"@",
"Override",
"public",
"void",
"registerChildren",
"(",
"ManagementResourceRegistration",
"resourceRegistration",
")",
"{",
"// Register wildcard children last to prevent duplicate registration errors when override definitions exist",
"for",
"(",
"ResourceDefinition",
"rd",
":",
... | Register child resources associated with this resource.
@param resourceRegistration a {@link org.jboss.as.controller.registry.ManagementResourceRegistration} created from this definition | [
"Register",
"child",
"resources",
"associated",
"with",
"this",
"resource",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/LegacyResourceDefinition.java#L147-L156 | train |
wildfly/wildfly-core | remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java | ManagementRemotingServices.installDomainConnectorServices | public static void installDomainConnectorServices(final OperationContext context,
final ServiceTarget serviceTarget,
final ServiceName endpointName,
final ServiceName networkInterfaceBinding,
final int port,
final OptionMap options,
final ServiceName securityRealm,
final ServiceName saslAuthenticationFactory,
final ServiceName sslContext) {
String sbmCap = "org.wildfly.management.socket-binding-manager";
ServiceName sbmName = context.hasOptionalCapability(sbmCap, NATIVE_MANAGEMENT_RUNTIME_CAPABILITY.getName(), null)
? context.getCapabilityServiceName(sbmCap, SocketBindingManager.class) : null;
installConnectorServicesForNetworkInterfaceBinding(serviceTarget, endpointName, MANAGEMENT_CONNECTOR,
networkInterfaceBinding, port, options, securityRealm, saslAuthenticationFactory, sslContext, sbmName);
} | java | public static void installDomainConnectorServices(final OperationContext context,
final ServiceTarget serviceTarget,
final ServiceName endpointName,
final ServiceName networkInterfaceBinding,
final int port,
final OptionMap options,
final ServiceName securityRealm,
final ServiceName saslAuthenticationFactory,
final ServiceName sslContext) {
String sbmCap = "org.wildfly.management.socket-binding-manager";
ServiceName sbmName = context.hasOptionalCapability(sbmCap, NATIVE_MANAGEMENT_RUNTIME_CAPABILITY.getName(), null)
? context.getCapabilityServiceName(sbmCap, SocketBindingManager.class) : null;
installConnectorServicesForNetworkInterfaceBinding(serviceTarget, endpointName, MANAGEMENT_CONNECTOR,
networkInterfaceBinding, port, options, securityRealm, saslAuthenticationFactory, sslContext, sbmName);
} | [
"public",
"static",
"void",
"installDomainConnectorServices",
"(",
"final",
"OperationContext",
"context",
",",
"final",
"ServiceTarget",
"serviceTarget",
",",
"final",
"ServiceName",
"endpointName",
",",
"final",
"ServiceName",
"networkInterfaceBinding",
",",
"final",
"i... | Installs a remoting stream server for a domain instance
@param serviceTarget the service target to install the services into
@param endpointName the name of the endpoint to install the stream server into
@param networkInterfaceBinding the network interface binding
@param port the port
@param securityRealm the security real name
@param options the remoting options | [
"Installs",
"a",
"remoting",
"stream",
"server",
"for",
"a",
"domain",
"instance"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java#L89-L103 | train |
wildfly/wildfly-core | remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java | ManagementRemotingServices.installManagementChannelServices | public static void installManagementChannelServices(
final ServiceTarget serviceTarget,
final ServiceName endpointName,
final AbstractModelControllerOperationHandlerFactoryService operationHandlerService,
final ServiceName modelControllerName,
final String channelName,
final ServiceName executorServiceName,
final ServiceName scheduledExecutorServiceName) {
final OptionMap options = OptionMap.EMPTY;
final ServiceName operationHandlerName = endpointName.append(channelName).append(ModelControllerClientOperationHandlerFactoryService.OPERATION_HANDLER_NAME_SUFFIX);
serviceTarget.addService(operationHandlerName, operationHandlerService)
.addDependency(modelControllerName, ModelController.class, operationHandlerService.getModelControllerInjector())
.addDependency(executorServiceName, ExecutorService.class, operationHandlerService.getExecutorInjector())
.addDependency(scheduledExecutorServiceName, ScheduledExecutorService.class, operationHandlerService.getScheduledExecutorInjector())
.setInitialMode(ACTIVE)
.install();
installManagementChannelOpenListenerService(serviceTarget, endpointName, channelName, operationHandlerName, options, false);
} | java | public static void installManagementChannelServices(
final ServiceTarget serviceTarget,
final ServiceName endpointName,
final AbstractModelControllerOperationHandlerFactoryService operationHandlerService,
final ServiceName modelControllerName,
final String channelName,
final ServiceName executorServiceName,
final ServiceName scheduledExecutorServiceName) {
final OptionMap options = OptionMap.EMPTY;
final ServiceName operationHandlerName = endpointName.append(channelName).append(ModelControllerClientOperationHandlerFactoryService.OPERATION_HANDLER_NAME_SUFFIX);
serviceTarget.addService(operationHandlerName, operationHandlerService)
.addDependency(modelControllerName, ModelController.class, operationHandlerService.getModelControllerInjector())
.addDependency(executorServiceName, ExecutorService.class, operationHandlerService.getExecutorInjector())
.addDependency(scheduledExecutorServiceName, ScheduledExecutorService.class, operationHandlerService.getScheduledExecutorInjector())
.setInitialMode(ACTIVE)
.install();
installManagementChannelOpenListenerService(serviceTarget, endpointName, channelName, operationHandlerName, options, false);
} | [
"public",
"static",
"void",
"installManagementChannelServices",
"(",
"final",
"ServiceTarget",
"serviceTarget",
",",
"final",
"ServiceName",
"endpointName",
",",
"final",
"AbstractModelControllerOperationHandlerFactoryService",
"operationHandlerService",
",",
"final",
"ServiceNam... | Set up the services to create a channel listener and operation handler service.
@param serviceTarget the service target to install the services into
@param endpointName the endpoint name to install the services into
@param channelName the name of the channel
@param executorServiceName service name of the executor service to use in the operation handler service
@param scheduledExecutorServiceName service name of the scheduled executor service to use in the operation handler service | [
"Set",
"up",
"the",
"services",
"to",
"create",
"a",
"channel",
"listener",
"and",
"operation",
"handler",
"service",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java#L145-L165 | train |
wildfly/wildfly-core | remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java | ManagementRemotingServices.isManagementResourceRemoveable | public static void isManagementResourceRemoveable(OperationContext context, PathAddress otherManagementEndpoint) throws OperationFailedException {
ModelNode remotingConnector;
try {
remotingConnector = context.readResourceFromRoot(
PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, "jmx"), PathElement.pathElement("remoting-connector", "jmx")), false).getModel();
} catch (Resource.NoSuchResourceException ex) {
return;
}
if (!remotingConnector.hasDefined(USE_MGMT_ENDPOINT) ||
(remotingConnector.hasDefined(USE_MGMT_ENDPOINT) && context.resolveExpressions(remotingConnector.get(USE_MGMT_ENDPOINT)).asBoolean(true))) {
try {
context.readResourceFromRoot(otherManagementEndpoint, false);
} catch (NoSuchElementException ex) {
throw RemotingLogger.ROOT_LOGGER.couldNotRemoveResource(context.getCurrentAddress());
}
}
} | java | public static void isManagementResourceRemoveable(OperationContext context, PathAddress otherManagementEndpoint) throws OperationFailedException {
ModelNode remotingConnector;
try {
remotingConnector = context.readResourceFromRoot(
PathAddress.pathAddress(PathElement.pathElement(SUBSYSTEM, "jmx"), PathElement.pathElement("remoting-connector", "jmx")), false).getModel();
} catch (Resource.NoSuchResourceException ex) {
return;
}
if (!remotingConnector.hasDefined(USE_MGMT_ENDPOINT) ||
(remotingConnector.hasDefined(USE_MGMT_ENDPOINT) && context.resolveExpressions(remotingConnector.get(USE_MGMT_ENDPOINT)).asBoolean(true))) {
try {
context.readResourceFromRoot(otherManagementEndpoint, false);
} catch (NoSuchElementException ex) {
throw RemotingLogger.ROOT_LOGGER.couldNotRemoveResource(context.getCurrentAddress());
}
}
} | [
"public",
"static",
"void",
"isManagementResourceRemoveable",
"(",
"OperationContext",
"context",
",",
"PathAddress",
"otherManagementEndpoint",
")",
"throws",
"OperationFailedException",
"{",
"ModelNode",
"remotingConnector",
";",
"try",
"{",
"remotingConnector",
"=",
"con... | Manual check because introducing a capability can't be done without a full refactoring.
This has to go as soon as the management interfaces are redesigned.
@param context the OperationContext
@param otherManagementEndpoint : the address to check that may provide an exposed jboss-remoting endpoint.
@throws OperationFailedException in case we can't remove the management resource. | [
"Manual",
"check",
"because",
"introducing",
"a",
"capability",
"can",
"t",
"be",
"done",
"without",
"a",
"full",
"refactoring",
".",
"This",
"has",
"to",
"go",
"as",
"soon",
"as",
"the",
"management",
"interfaces",
"are",
"redesigned",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java#L183-L199 | train |
wildfly/wildfly-core | elytron/src/main/java/org/wildfly/extension/elytron/CertificateChainAttributeDefinitions.java | CertificateChainAttributeDefinitions.writeCertificates | static void writeCertificates(final ModelNode result, final Certificate[] certificates) throws CertificateEncodingException, NoSuchAlgorithmException {
if (certificates != null) {
for (Certificate current : certificates) {
ModelNode certificate = new ModelNode();
writeCertificate(certificate, current);
result.add(certificate);
}
}
} | java | static void writeCertificates(final ModelNode result, final Certificate[] certificates) throws CertificateEncodingException, NoSuchAlgorithmException {
if (certificates != null) {
for (Certificate current : certificates) {
ModelNode certificate = new ModelNode();
writeCertificate(certificate, current);
result.add(certificate);
}
}
} | [
"static",
"void",
"writeCertificates",
"(",
"final",
"ModelNode",
"result",
",",
"final",
"Certificate",
"[",
"]",
"certificates",
")",
"throws",
"CertificateEncodingException",
",",
"NoSuchAlgorithmException",
"{",
"if",
"(",
"certificates",
"!=",
"null",
")",
"{",... | Populate the supplied response with the model representation of the certificates.
@param result the response to populate.
@param certificates the certificates to add to the response.
@throws CertificateEncodingException
@throws NoSuchAlgorithmException | [
"Populate",
"the",
"supplied",
"response",
"with",
"the",
"model",
"representation",
"of",
"the",
"certificates",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/CertificateChainAttributeDefinitions.java#L156-L164 | train |
wildfly/wildfly-core | jmx/src/main/java/org/jboss/as/jmx/model/ModelControllerMBeanHelper.java | ModelControllerMBeanHelper.setQueryExpServer | private static MBeanServer setQueryExpServer(QueryExp query, MBeanServer toSet) {
// We assume the QueryExp is a QueryEval subclass or uses the QueryEval thread local
// mechanism to store any existing MBeanServer. If that's not the case we have no
// way to access the old mbeanserver to let us restore it
MBeanServer result = QueryEval.getMBeanServer();
query.setMBeanServer(toSet);
return result;
} | java | private static MBeanServer setQueryExpServer(QueryExp query, MBeanServer toSet) {
// We assume the QueryExp is a QueryEval subclass or uses the QueryEval thread local
// mechanism to store any existing MBeanServer. If that's not the case we have no
// way to access the old mbeanserver to let us restore it
MBeanServer result = QueryEval.getMBeanServer();
query.setMBeanServer(toSet);
return result;
} | [
"private",
"static",
"MBeanServer",
"setQueryExpServer",
"(",
"QueryExp",
"query",
",",
"MBeanServer",
"toSet",
")",
"{",
"// We assume the QueryExp is a QueryEval subclass or uses the QueryEval thread local",
"// mechanism to store any existing MBeanServer. If that's not the case we have ... | Set the mbean server on the QueryExp and try and pass back any previously set one | [
"Set",
"the",
"mbean",
"server",
"on",
"the",
"QueryExp",
"and",
"try",
"and",
"pass",
"back",
"any",
"previously",
"set",
"one"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/model/ModelControllerMBeanHelper.java#L234-L241 | train |
wildfly/wildfly-core | jmx/src/main/java/org/jboss/as/jmx/model/ModelControllerMBeanHelper.java | ModelControllerMBeanHelper.toPathAddress | PathAddress toPathAddress(final ObjectName name) {
return ObjectNameAddressUtil.toPathAddress(rootObjectInstance.getObjectName(), getRootResourceAndRegistration().getRegistration(), name);
} | java | PathAddress toPathAddress(final ObjectName name) {
return ObjectNameAddressUtil.toPathAddress(rootObjectInstance.getObjectName(), getRootResourceAndRegistration().getRegistration(), name);
} | [
"PathAddress",
"toPathAddress",
"(",
"final",
"ObjectName",
"name",
")",
"{",
"return",
"ObjectNameAddressUtil",
".",
"toPathAddress",
"(",
"rootObjectInstance",
".",
"getObjectName",
"(",
")",
",",
"getRootResourceAndRegistration",
"(",
")",
".",
"getRegistration",
"... | Convert an ObjectName to a PathAddress.
Patterns are supported: there may not be a resource at the returned PathAddress but a resource model <strong>MUST</strong>
must be registered. | [
"Convert",
"an",
"ObjectName",
"to",
"a",
"PathAddress",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/model/ModelControllerMBeanHelper.java#L259-L261 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolHandlers.java | TransactionalProtocolHandlers.createClient | public static TransactionalProtocolClient createClient(final ManagementChannelHandler channelAssociation) {
final TransactionalProtocolClientImpl client = new TransactionalProtocolClientImpl(channelAssociation);
channelAssociation.addHandlerFactory(client);
return client;
} | java | public static TransactionalProtocolClient createClient(final ManagementChannelHandler channelAssociation) {
final TransactionalProtocolClientImpl client = new TransactionalProtocolClientImpl(channelAssociation);
channelAssociation.addHandlerFactory(client);
return client;
} | [
"public",
"static",
"TransactionalProtocolClient",
"createClient",
"(",
"final",
"ManagementChannelHandler",
"channelAssociation",
")",
"{",
"final",
"TransactionalProtocolClientImpl",
"client",
"=",
"new",
"TransactionalProtocolClientImpl",
"(",
"channelAssociation",
")",
";",... | Create a transactional protocol client.
@param channelAssociation the channel handler
@return the transactional protocol client | [
"Create",
"a",
"transactional",
"protocol",
"client",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolHandlers.java#L47-L51 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolHandlers.java | TransactionalProtocolHandlers.wrap | public static TransactionalProtocolClient.Operation wrap(final ModelNode operation, final OperationMessageHandler messageHandler, final OperationAttachments attachments) {
return new TransactionalOperationImpl(operation, messageHandler, attachments);
} | java | public static TransactionalProtocolClient.Operation wrap(final ModelNode operation, final OperationMessageHandler messageHandler, final OperationAttachments attachments) {
return new TransactionalOperationImpl(operation, messageHandler, attachments);
} | [
"public",
"static",
"TransactionalProtocolClient",
".",
"Operation",
"wrap",
"(",
"final",
"ModelNode",
"operation",
",",
"final",
"OperationMessageHandler",
"messageHandler",
",",
"final",
"OperationAttachments",
"attachments",
")",
"{",
"return",
"new",
"TransactionalOp... | Wrap an operation's parameters in a simple encapsulating object
@param operation the operation
@param messageHandler the message handler
@param attachments the attachments
@return the encapsulating object | [
"Wrap",
"an",
"operation",
"s",
"parameters",
"in",
"a",
"simple",
"encapsulating",
"object"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolHandlers.java#L60-L62 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolHandlers.java | TransactionalProtocolHandlers.executeBlocking | public static TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> executeBlocking(final ModelNode operation, TransactionalProtocolClient client) throws IOException, InterruptedException {
final BlockingQueueOperationListener<TransactionalProtocolClient.Operation> listener = new BlockingQueueOperationListener<>();
client.execute(listener, operation, OperationMessageHandler.DISCARD, OperationAttachments.EMPTY);
return listener.retrievePreparedOperation();
} | java | public static TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> executeBlocking(final ModelNode operation, TransactionalProtocolClient client) throws IOException, InterruptedException {
final BlockingQueueOperationListener<TransactionalProtocolClient.Operation> listener = new BlockingQueueOperationListener<>();
client.execute(listener, operation, OperationMessageHandler.DISCARD, OperationAttachments.EMPTY);
return listener.retrievePreparedOperation();
} | [
"public",
"static",
"TransactionalProtocolClient",
".",
"PreparedOperation",
"<",
"TransactionalProtocolClient",
".",
"Operation",
">",
"executeBlocking",
"(",
"final",
"ModelNode",
"operation",
",",
"TransactionalProtocolClient",
"client",
")",
"throws",
"IOException",
","... | Execute blocking for a prepared result.
@param operation the operation to execute
@param client the protocol client
@return the prepared operation
@throws IOException
@throws InterruptedException | [
"Execute",
"blocking",
"for",
"a",
"prepared",
"result",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolHandlers.java#L73-L77 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/component/ServerLogsTableModel.java | ServerLogsTableModel.init | private void init() {
if (initialized.compareAndSet(false, true)) {
final RowSorter<? extends TableModel> rowSorter = table.getRowSorter();
rowSorter.toggleSortOrder(1); // sort by date
rowSorter.toggleSortOrder(1); // descending
final TableColumnModel columnModel = table.getColumnModel();
columnModel.getColumn(1).setCellRenderer(dateRenderer);
columnModel.getColumn(2).setCellRenderer(sizeRenderer);
}
} | java | private void init() {
if (initialized.compareAndSet(false, true)) {
final RowSorter<? extends TableModel> rowSorter = table.getRowSorter();
rowSorter.toggleSortOrder(1); // sort by date
rowSorter.toggleSortOrder(1); // descending
final TableColumnModel columnModel = table.getColumnModel();
columnModel.getColumn(1).setCellRenderer(dateRenderer);
columnModel.getColumn(2).setCellRenderer(sizeRenderer);
}
} | [
"private",
"void",
"init",
"(",
")",
"{",
"if",
"(",
"initialized",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"final",
"RowSorter",
"<",
"?",
"extends",
"TableModel",
">",
"rowSorter",
"=",
"table",
".",
"getRowSorter",
"(",
")",
... | Initializes the model | [
"Initializes",
"the",
"model"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/component/ServerLogsTableModel.java#L91-L100 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/management/DeleteOp.java | DeleteOp.execute | public void execute() throws IOException {
try {
prepare();
boolean commitResult = commit();
if (commitResult == false) {
throw PatchLogger.ROOT_LOGGER.failedToDeleteBackup();
}
} catch (PrepareException pe){
rollback();
throw PatchLogger.ROOT_LOGGER.failedToDelete(pe.getPath());
}
} | java | public void execute() throws IOException {
try {
prepare();
boolean commitResult = commit();
if (commitResult == false) {
throw PatchLogger.ROOT_LOGGER.failedToDeleteBackup();
}
} catch (PrepareException pe){
rollback();
throw PatchLogger.ROOT_LOGGER.failedToDelete(pe.getPath());
}
} | [
"public",
"void",
"execute",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"prepare",
"(",
")",
";",
"boolean",
"commitResult",
"=",
"commit",
"(",
")",
";",
"if",
"(",
"commitResult",
"==",
"false",
")",
"{",
"throw",
"PatchLogger",
".",
"ROOT_LOG... | remove files from directory. All-or-nothing operation - if any of the files fails to be removed, all deleted files are restored.
The operation is performed in two steps - first all the files are moved to a backup folder, and afterwards backup folder is removed.
If an error occurs in the first step of the operation, all files are restored and the operation ends with status {@code false}.
If an error occurs in the second step, the operation ends with status {@code false}, but the files are not rolled back.
@throws IOException if an error occurred | [
"remove",
"files",
"from",
"directory",
".",
"All",
"-",
"or",
"-",
"nothing",
"operation",
"-",
"if",
"any",
"of",
"the",
"files",
"fails",
"to",
"be",
"removed",
"all",
"deleted",
"files",
"are",
"restored",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/management/DeleteOp.java#L54-L68 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/controller/git/GitRepository.java | GitRepository.rollback | public void rollback() throws GitAPIException {
try (Git git = getGit()) {
git.reset().setMode(ResetCommand.ResetType.HARD).setRef(HEAD).call();
}
} | java | public void rollback() throws GitAPIException {
try (Git git = getGit()) {
git.reset().setMode(ResetCommand.ResetType.HARD).setRef(HEAD).call();
}
} | [
"public",
"void",
"rollback",
"(",
")",
"throws",
"GitAPIException",
"{",
"try",
"(",
"Git",
"git",
"=",
"getGit",
"(",
")",
")",
"{",
"git",
".",
"reset",
"(",
")",
".",
"setMode",
"(",
"ResetCommand",
".",
"ResetType",
".",
"HARD",
")",
".",
"setRe... | Reset hard on HEAD.
@throws GitAPIException | [
"Reset",
"hard",
"on",
"HEAD",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/controller/git/GitRepository.java#L294-L298 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/controller/git/GitRepository.java | GitRepository.commit | public void commit(String msg) throws GitAPIException {
try (Git git = getGit()) {
Status status = git.status().call();
if (!status.isClean()) {
git.commit().setMessage(msg).setAll(true).setNoVerify(true).call();
}
}
} | java | public void commit(String msg) throws GitAPIException {
try (Git git = getGit()) {
Status status = git.status().call();
if (!status.isClean()) {
git.commit().setMessage(msg).setAll(true).setNoVerify(true).call();
}
}
} | [
"public",
"void",
"commit",
"(",
"String",
"msg",
")",
"throws",
"GitAPIException",
"{",
"try",
"(",
"Git",
"git",
"=",
"getGit",
"(",
")",
")",
"{",
"Status",
"status",
"=",
"git",
".",
"status",
"(",
")",
".",
"call",
"(",
")",
";",
"if",
"(",
... | Commit all changes if there are uncommitted changes.
@param msg the commit message.
@throws GitAPIException | [
"Commit",
"all",
"changes",
"if",
"there",
"are",
"uncommitted",
"changes",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/controller/git/GitRepository.java#L306-L313 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/extension/ExtensionAddHandler.java | ExtensionAddHandler.initializeExtension | static void initializeExtension(ExtensionRegistry extensionRegistry, String module,
ManagementResourceRegistration rootRegistration,
ExtensionRegistryType extensionRegistryType) {
try {
boolean unknownModule = false;
boolean initialized = false;
for (Extension extension : Module.loadServiceFromCallerModuleLoader(module, Extension.class)) {
ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(extension.getClass());
try {
if (unknownModule || !extensionRegistry.getExtensionModuleNames().contains(module)) {
// This extension wasn't handled by the standalone.xml or domain.xml parsing logic, so we
// need to initialize its parsers so we can display what XML namespaces it supports
extensionRegistry.initializeParsers(extension, module, null);
// AS7-6190 - ensure we initialize parsers for other extensions from this module
// now that we know the registry was unaware of the module
unknownModule = true;
}
extension.initialize(extensionRegistry.getExtensionContext(module, rootRegistration, extensionRegistryType));
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
}
initialized = true;
}
if (!initialized) {
throw ControllerLogger.ROOT_LOGGER.notFound("META-INF/services/", Extension.class.getName(), module);
}
} catch (ModuleNotFoundException e) {
// Treat this as a user mistake, e.g. incorrect module name.
// Throw OFE so post-boot it only gets logged at DEBUG.
throw ControllerLogger.ROOT_LOGGER.extensionModuleNotFound(e, module);
} catch (ModuleLoadException e) {
// The module is there but can't be loaded. Treat this as an internal problem.
// Throw a runtime exception so it always gets logged at ERROR in the server log with stack trace details.
throw ControllerLogger.ROOT_LOGGER.extensionModuleLoadingFailure(e, module);
}
} | java | static void initializeExtension(ExtensionRegistry extensionRegistry, String module,
ManagementResourceRegistration rootRegistration,
ExtensionRegistryType extensionRegistryType) {
try {
boolean unknownModule = false;
boolean initialized = false;
for (Extension extension : Module.loadServiceFromCallerModuleLoader(module, Extension.class)) {
ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(extension.getClass());
try {
if (unknownModule || !extensionRegistry.getExtensionModuleNames().contains(module)) {
// This extension wasn't handled by the standalone.xml or domain.xml parsing logic, so we
// need to initialize its parsers so we can display what XML namespaces it supports
extensionRegistry.initializeParsers(extension, module, null);
// AS7-6190 - ensure we initialize parsers for other extensions from this module
// now that we know the registry was unaware of the module
unknownModule = true;
}
extension.initialize(extensionRegistry.getExtensionContext(module, rootRegistration, extensionRegistryType));
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
}
initialized = true;
}
if (!initialized) {
throw ControllerLogger.ROOT_LOGGER.notFound("META-INF/services/", Extension.class.getName(), module);
}
} catch (ModuleNotFoundException e) {
// Treat this as a user mistake, e.g. incorrect module name.
// Throw OFE so post-boot it only gets logged at DEBUG.
throw ControllerLogger.ROOT_LOGGER.extensionModuleNotFound(e, module);
} catch (ModuleLoadException e) {
// The module is there but can't be loaded. Treat this as an internal problem.
// Throw a runtime exception so it always gets logged at ERROR in the server log with stack trace details.
throw ControllerLogger.ROOT_LOGGER.extensionModuleLoadingFailure(e, module);
}
} | [
"static",
"void",
"initializeExtension",
"(",
"ExtensionRegistry",
"extensionRegistry",
",",
"String",
"module",
",",
"ManagementResourceRegistration",
"rootRegistration",
",",
"ExtensionRegistryType",
"extensionRegistryType",
")",
"{",
"try",
"{",
"boolean",
"unknownModule",... | Initialise an extension module's extensions in the extension registry
@param extensionRegistry the extension registry
@param module the name of the module containing the extensions
@param rootRegistration The parent registration of the extensions. For a server or domain.xml extension, this will be the root resource registration. For a host.xml extension, this will be the host resource registration
@param extensionRegistryType The type of the registry | [
"Initialise",
"an",
"extension",
"module",
"s",
"extensions",
"in",
"the",
"extension",
"registry"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/extension/ExtensionAddHandler.java#L114-L149 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java | PathManagerService.addDependent | private void addDependent(String pathName, String relativeTo) {
if (relativeTo != null) {
Set<String> dependents = dependenctRelativePaths.get(relativeTo);
if (dependents == null) {
dependents = new HashSet<String>();
dependenctRelativePaths.put(relativeTo, dependents);
}
dependents.add(pathName);
}
} | java | private void addDependent(String pathName, String relativeTo) {
if (relativeTo != null) {
Set<String> dependents = dependenctRelativePaths.get(relativeTo);
if (dependents == null) {
dependents = new HashSet<String>();
dependenctRelativePaths.put(relativeTo, dependents);
}
dependents.add(pathName);
}
} | [
"private",
"void",
"addDependent",
"(",
"String",
"pathName",
",",
"String",
"relativeTo",
")",
"{",
"if",
"(",
"relativeTo",
"!=",
"null",
")",
"{",
"Set",
"<",
"String",
">",
"dependents",
"=",
"dependenctRelativePaths",
".",
"get",
"(",
"relativeTo",
")",... | Must be called with pathEntries lock taken | [
"Must",
"be",
"called",
"with",
"pathEntries",
"lock",
"taken"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java#L359-L368 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java | PathManagerService.getAllDependents | private void getAllDependents(Set<PathEntry> result, String name) {
Set<String> depNames = dependenctRelativePaths.get(name);
if (depNames == null) {
return;
}
for (String dep : depNames) {
PathEntry entry = pathEntries.get(dep);
if (entry != null) {
result.add(entry);
getAllDependents(result, dep);
}
}
} | java | private void getAllDependents(Set<PathEntry> result, String name) {
Set<String> depNames = dependenctRelativePaths.get(name);
if (depNames == null) {
return;
}
for (String dep : depNames) {
PathEntry entry = pathEntries.get(dep);
if (entry != null) {
result.add(entry);
getAllDependents(result, dep);
}
}
} | [
"private",
"void",
"getAllDependents",
"(",
"Set",
"<",
"PathEntry",
">",
"result",
",",
"String",
"name",
")",
"{",
"Set",
"<",
"String",
">",
"depNames",
"=",
"dependenctRelativePaths",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"depNames",
"==",
"n... | Call with pathEntries lock taken | [
"Call",
"with",
"pathEntries",
"lock",
"taken"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java#L463-L475 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/model/jvm/JvmOptionsElement.java | JvmOptionsElement.addOption | void addOption(final String value) {
Assert.checkNotNullParam("value", value);
synchronized (options) {
options.add(value);
}
} | java | void addOption(final String value) {
Assert.checkNotNullParam("value", value);
synchronized (options) {
options.add(value);
}
} | [
"void",
"addOption",
"(",
"final",
"String",
"value",
")",
"{",
"Assert",
".",
"checkNotNullParam",
"(",
"\"value\"",
",",
"value",
")",
";",
"synchronized",
"(",
"options",
")",
"{",
"options",
".",
"add",
"(",
"value",
")",
";",
"}",
"}"
] | Adds an option to the Jvm options
@param value the option to add | [
"Adds",
"an",
"option",
"to",
"the",
"Jvm",
"options"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/model/jvm/JvmOptionsElement.java#L51-L56 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/AttachmentKey.java | AttachmentKey.create | @SuppressWarnings("unchecked")
public static <T> AttachmentKey<T> create(final Class<? super T> valueClass) {
return new SimpleAttachmentKey(valueClass);
} | java | @SuppressWarnings("unchecked")
public static <T> AttachmentKey<T> create(final Class<? super T> valueClass) {
return new SimpleAttachmentKey(valueClass);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"AttachmentKey",
"<",
"T",
">",
"create",
"(",
"final",
"Class",
"<",
"?",
"super",
"T",
">",
"valueClass",
")",
"{",
"return",
"new",
"SimpleAttachmentKey",
"(",
"value... | Construct a new simple attachment key.
@param valueClass the value class
@param <T> the attachment type
@return the new instance | [
"Construct",
"a",
"new",
"simple",
"attachment",
"key",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/AttachmentKey.java#L50-L53 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchContentLoader.java | PatchContentLoader.openContentStream | InputStream openContentStream(final ContentItem item) throws IOException {
final File file = getFile(item);
if (file == null) {
throw new IllegalStateException();
}
return new FileInputStream(file);
} | java | InputStream openContentStream(final ContentItem item) throws IOException {
final File file = getFile(item);
if (file == null) {
throw new IllegalStateException();
}
return new FileInputStream(file);
} | [
"InputStream",
"openContentStream",
"(",
"final",
"ContentItem",
"item",
")",
"throws",
"IOException",
"{",
"final",
"File",
"file",
"=",
"getFile",
"(",
"item",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(... | Open a new content stream.
@param item the content item
@return the content stream | [
"Open",
"a",
"new",
"content",
"stream",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchContentLoader.java#L66-L72 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/aesh/cmd/security/model/SSLSecurityBuilder.java | SSLSecurityBuilder.buildExecutableRequest | public ModelNode buildExecutableRequest(CommandContext ctx) throws Exception {
try {
for (FailureDescProvider h : providers) {
effectiveProviders.add(h);
}
// In case some key-store needs to be persisted
for (String ks : ksToStore) {
composite.get(Util.STEPS).add(ElytronUtil.storeKeyStore(ctx, ks));
effectiveProviders.add(new FailureDescProvider() {
@Override
public String stepFailedDescription() {
return "Storing the key-store " + ksToStore;
}
});
}
// Final steps
for (int i = 0; i < finalSteps.size(); i++) {
composite.get(Util.STEPS).add(finalSteps.get(i));
effectiveProviders.add(finalProviders.get(i));
}
return composite;
} catch (Exception ex) {
try {
failureOccured(ctx, null);
} catch (Exception ex2) {
ex.addSuppressed(ex2);
}
throw ex;
}
} | java | public ModelNode buildExecutableRequest(CommandContext ctx) throws Exception {
try {
for (FailureDescProvider h : providers) {
effectiveProviders.add(h);
}
// In case some key-store needs to be persisted
for (String ks : ksToStore) {
composite.get(Util.STEPS).add(ElytronUtil.storeKeyStore(ctx, ks));
effectiveProviders.add(new FailureDescProvider() {
@Override
public String stepFailedDescription() {
return "Storing the key-store " + ksToStore;
}
});
}
// Final steps
for (int i = 0; i < finalSteps.size(); i++) {
composite.get(Util.STEPS).add(finalSteps.get(i));
effectiveProviders.add(finalProviders.get(i));
}
return composite;
} catch (Exception ex) {
try {
failureOccured(ctx, null);
} catch (Exception ex2) {
ex.addSuppressed(ex2);
}
throw ex;
}
} | [
"public",
"ModelNode",
"buildExecutableRequest",
"(",
"CommandContext",
"ctx",
")",
"throws",
"Exception",
"{",
"try",
"{",
"for",
"(",
"FailureDescProvider",
"h",
":",
"providers",
")",
"{",
"effectiveProviders",
".",
"add",
"(",
"h",
")",
";",
"}",
"// In ca... | Sort and order steps to avoid unwanted generation | [
"Sort",
"and",
"order",
"steps",
"to",
"avoid",
"unwanted",
"generation"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/aesh/cmd/security/model/SSLSecurityBuilder.java#L100-L129 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/module/ManifestAttachmentProcessor.java | ManifestAttachmentProcessor.deploy | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
for (ResourceRoot resourceRoot : resourceRoots) {
if (IgnoreMetaInfMarker.isIgnoreMetaInf(resourceRoot)) {
continue;
}
Manifest manifest = getManifest(resourceRoot);
if (manifest != null)
resourceRoot.putAttachment(Attachments.MANIFEST, manifest);
}
} | java | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit);
for (ResourceRoot resourceRoot : resourceRoots) {
if (IgnoreMetaInfMarker.isIgnoreMetaInf(resourceRoot)) {
continue;
}
Manifest manifest = getManifest(resourceRoot);
if (manifest != null)
resourceRoot.putAttachment(Attachments.MANIFEST, manifest);
}
} | [
"@",
"Override",
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"List",
"<",
... | Process the deployment root for the manifest.
@param phaseContext the deployment unit context
@throws DeploymentUnitProcessingException | [
"Process",
"the",
"deployment",
"root",
"for",
"the",
"manifest",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/module/ManifestAttachmentProcessor.java#L56-L69 | train |
wildfly/wildfly-core | elytron/src/main/java/org/wildfly/extension/elytron/MapperParser.java | MapperParser.getSimpleMapperParser | private PersistentResourceXMLDescription getSimpleMapperParser() {
if (version.equals(Version.VERSION_1_0)) {
return simpleMapperParser_1_0;
} else if (version.equals(Version.VERSION_1_1)) {
return simpleMapperParser_1_1;
}
return simpleMapperParser;
} | java | private PersistentResourceXMLDescription getSimpleMapperParser() {
if (version.equals(Version.VERSION_1_0)) {
return simpleMapperParser_1_0;
} else if (version.equals(Version.VERSION_1_1)) {
return simpleMapperParser_1_1;
}
return simpleMapperParser;
} | [
"private",
"PersistentResourceXMLDescription",
"getSimpleMapperParser",
"(",
")",
"{",
"if",
"(",
"version",
".",
"equals",
"(",
"Version",
".",
"VERSION_1_0",
")",
")",
"{",
"return",
"simpleMapperParser_1_0",
";",
"}",
"else",
"if",
"(",
"version",
".",
"equal... | 1.0 version of parser is different at simple mapperParser | [
"1",
".",
"0",
"version",
"of",
"parser",
"is",
"different",
"at",
"simple",
"mapperParser"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/MapperParser.java#L235-L242 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentUtils.java | DeploymentUtils.getTopDeploymentUnit | public static DeploymentUnit getTopDeploymentUnit(DeploymentUnit unit) {
Assert.checkNotNullParam("unit", unit);
DeploymentUnit parent = unit.getParent();
while (parent != null) {
unit = parent;
parent = unit.getParent();
}
return unit;
} | java | public static DeploymentUnit getTopDeploymentUnit(DeploymentUnit unit) {
Assert.checkNotNullParam("unit", unit);
DeploymentUnit parent = unit.getParent();
while (parent != null) {
unit = parent;
parent = unit.getParent();
}
return unit;
} | [
"public",
"static",
"DeploymentUnit",
"getTopDeploymentUnit",
"(",
"DeploymentUnit",
"unit",
")",
"{",
"Assert",
".",
"checkNotNullParam",
"(",
"\"unit\"",
",",
"unit",
")",
";",
"DeploymentUnit",
"parent",
"=",
"unit",
".",
"getParent",
"(",
")",
";",
"while",
... | Get top deployment unit.
@param unit the current deployment unit
@return top deployment unit | [
"Get",
"top",
"deployment",
"unit",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentUtils.java#L80-L89 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnection.java | RemoteDomainConnection.openConnection | protected Connection openConnection() throws IOException {
// Perhaps this can just be done once?
CallbackHandler callbackHandler = null;
SSLContext sslContext = null;
if (realm != null) {
sslContext = realm.getSSLContext();
CallbackHandlerFactory handlerFactory = realm.getSecretCallbackHandlerFactory();
if (handlerFactory != null) {
String username = this.username != null ? this.username : localHostName;
callbackHandler = handlerFactory.getCallbackHandler(username);
}
}
final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration);
config.setCallbackHandler(callbackHandler);
config.setSslContext(sslContext);
config.setUri(uri);
AuthenticationContext authenticationContext = this.authenticationContext != null ? this.authenticationContext : AuthenticationContext.captureCurrent();
// Connect
try {
return authenticationContext.run((PrivilegedExceptionAction<Connection>) () -> ProtocolConnectionUtils.connectSync(config));
} catch (PrivilegedActionException e) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
}
throw new IOException(e);
}
} | java | protected Connection openConnection() throws IOException {
// Perhaps this can just be done once?
CallbackHandler callbackHandler = null;
SSLContext sslContext = null;
if (realm != null) {
sslContext = realm.getSSLContext();
CallbackHandlerFactory handlerFactory = realm.getSecretCallbackHandlerFactory();
if (handlerFactory != null) {
String username = this.username != null ? this.username : localHostName;
callbackHandler = handlerFactory.getCallbackHandler(username);
}
}
final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration);
config.setCallbackHandler(callbackHandler);
config.setSslContext(sslContext);
config.setUri(uri);
AuthenticationContext authenticationContext = this.authenticationContext != null ? this.authenticationContext : AuthenticationContext.captureCurrent();
// Connect
try {
return authenticationContext.run((PrivilegedExceptionAction<Connection>) () -> ProtocolConnectionUtils.connectSync(config));
} catch (PrivilegedActionException e) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
}
throw new IOException(e);
}
} | [
"protected",
"Connection",
"openConnection",
"(",
")",
"throws",
"IOException",
"{",
"// Perhaps this can just be done once?",
"CallbackHandler",
"callbackHandler",
"=",
"null",
";",
"SSLContext",
"sslContext",
"=",
"null",
";",
"if",
"(",
"realm",
"!=",
"null",
")",
... | Connect and register at the remote domain controller.
@return connection the established connection
@throws IOException | [
"Connect",
"and",
"register",
"at",
"the",
"remote",
"domain",
"controller",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnection.java#L202-L230 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnection.java | RemoteDomainConnection.applyDomainModel | boolean applyDomainModel(ModelNode result) {
if(! result.hasDefined(ModelDescriptionConstants.RESULT)) {
return false;
}
final List<ModelNode> bootOperations= result.get(ModelDescriptionConstants.RESULT).asList();
return callback.applyDomainModel(bootOperations);
} | java | boolean applyDomainModel(ModelNode result) {
if(! result.hasDefined(ModelDescriptionConstants.RESULT)) {
return false;
}
final List<ModelNode> bootOperations= result.get(ModelDescriptionConstants.RESULT).asList();
return callback.applyDomainModel(bootOperations);
} | [
"boolean",
"applyDomainModel",
"(",
"ModelNode",
"result",
")",
"{",
"if",
"(",
"!",
"result",
".",
"hasDefined",
"(",
"ModelDescriptionConstants",
".",
"RESULT",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"List",
"<",
"ModelNode",
">",
"bootOperat... | Apply the remote read domain model result.
@param result the domain model result
@return whether it was applied successfully or not | [
"Apply",
"the",
"remote",
"read",
"domain",
"model",
"result",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnection.java#L320-L326 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/ProcessHelper.java | ProcessHelper.addShutdownHook | public static Thread addShutdownHook(final Process process) {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (process != null) {
process.destroy();
try {
process.waitFor();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
});
thread.setDaemon(true);
Runtime.getRuntime().addShutdownHook(thread);
return thread;
} | java | public static Thread addShutdownHook(final Process process) {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (process != null) {
process.destroy();
try {
process.waitFor();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
});
thread.setDaemon(true);
Runtime.getRuntime().addShutdownHook(thread);
return thread;
} | [
"public",
"static",
"Thread",
"addShutdownHook",
"(",
"final",
"Process",
"process",
")",
"{",
"final",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
... | Adds a shutdown hook for the process.
@param process the process to add a shutdown hook for
@return the thread set as the shutdown hook
@throws java.lang.SecurityException If a security manager is present and it denies {@link
java.lang.RuntimePermission <code>RuntimePermission("shutdownHooks")</code>} | [
"Adds",
"a",
"shutdown",
"hook",
"for",
"the",
"process",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/ProcessHelper.java#L73-L90 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/operations/common/OrderedChildTypesAttachment.java | OrderedChildTypesAttachment.addOrderedChildResourceTypes | public void addOrderedChildResourceTypes(PathAddress resourceAddress, Resource resource) {
Set<String> orderedChildTypes = resource.getOrderedChildTypes();
if (orderedChildTypes.size() > 0) {
orderedChildren.put(resourceAddress, resource.getOrderedChildTypes());
}
} | java | public void addOrderedChildResourceTypes(PathAddress resourceAddress, Resource resource) {
Set<String> orderedChildTypes = resource.getOrderedChildTypes();
if (orderedChildTypes.size() > 0) {
orderedChildren.put(resourceAddress, resource.getOrderedChildTypes());
}
} | [
"public",
"void",
"addOrderedChildResourceTypes",
"(",
"PathAddress",
"resourceAddress",
",",
"Resource",
"resource",
")",
"{",
"Set",
"<",
"String",
">",
"orderedChildTypes",
"=",
"resource",
".",
"getOrderedChildTypes",
"(",
")",
";",
"if",
"(",
"orderedChildTypes... | If the resource has ordered child types, those child types will be stored in the attachment. If there are no
ordered child types, this method is a no-op.
@param resourceAddress the address of the resource
@param resource the resource which may or may not have ordered children. | [
"If",
"the",
"resource",
"has",
"ordered",
"child",
"types",
"those",
"child",
"types",
"will",
"be",
"stored",
"in",
"the",
"attachment",
".",
"If",
"there",
"are",
"no",
"ordered",
"child",
"types",
"this",
"method",
"is",
"a",
"no",
"-",
"op",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/common/OrderedChildTypesAttachment.java#L32-L37 | train |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/helpers/domain/impl/DeploymentPlanResultImpl.java | DeploymentPlanResultImpl.buildServerGroupResults | private static Map<String, ServerGroupDeploymentPlanResult> buildServerGroupResults(Map<UUID, DeploymentActionResult> deploymentActionResults) {
Map<String, ServerGroupDeploymentPlanResult> serverGroupResults = new HashMap<String, ServerGroupDeploymentPlanResult>();
for (Map.Entry<UUID, DeploymentActionResult> entry : deploymentActionResults.entrySet()) {
UUID actionId = entry.getKey();
DeploymentActionResult actionResult = entry.getValue();
Map<String, ServerGroupDeploymentActionResult> actionResultsByServerGroup = actionResult.getResultsByServerGroup();
for (ServerGroupDeploymentActionResult serverGroupActionResult : actionResultsByServerGroup.values()) {
String serverGroupName = serverGroupActionResult.getServerGroupName();
ServerGroupDeploymentPlanResultImpl sgdpr = (ServerGroupDeploymentPlanResultImpl) serverGroupResults.get(serverGroupName);
if (sgdpr == null) {
sgdpr = new ServerGroupDeploymentPlanResultImpl(serverGroupName);
serverGroupResults.put(serverGroupName, sgdpr);
}
for (Map.Entry<String, ServerUpdateResult> serverEntry : serverGroupActionResult.getResultByServer().entrySet()) {
String serverName = serverEntry.getKey();
ServerUpdateResult sud = serverEntry.getValue();
ServerDeploymentPlanResultImpl sdpr = (ServerDeploymentPlanResultImpl) sgdpr.getServerResult(serverName);
if (sdpr == null) {
sdpr = new ServerDeploymentPlanResultImpl(serverName);
sgdpr.storeServerResult(serverName, sdpr);
}
sdpr.storeServerUpdateResult(actionId, sud);
}
}
}
return serverGroupResults;
} | java | private static Map<String, ServerGroupDeploymentPlanResult> buildServerGroupResults(Map<UUID, DeploymentActionResult> deploymentActionResults) {
Map<String, ServerGroupDeploymentPlanResult> serverGroupResults = new HashMap<String, ServerGroupDeploymentPlanResult>();
for (Map.Entry<UUID, DeploymentActionResult> entry : deploymentActionResults.entrySet()) {
UUID actionId = entry.getKey();
DeploymentActionResult actionResult = entry.getValue();
Map<String, ServerGroupDeploymentActionResult> actionResultsByServerGroup = actionResult.getResultsByServerGroup();
for (ServerGroupDeploymentActionResult serverGroupActionResult : actionResultsByServerGroup.values()) {
String serverGroupName = serverGroupActionResult.getServerGroupName();
ServerGroupDeploymentPlanResultImpl sgdpr = (ServerGroupDeploymentPlanResultImpl) serverGroupResults.get(serverGroupName);
if (sgdpr == null) {
sgdpr = new ServerGroupDeploymentPlanResultImpl(serverGroupName);
serverGroupResults.put(serverGroupName, sgdpr);
}
for (Map.Entry<String, ServerUpdateResult> serverEntry : serverGroupActionResult.getResultByServer().entrySet()) {
String serverName = serverEntry.getKey();
ServerUpdateResult sud = serverEntry.getValue();
ServerDeploymentPlanResultImpl sdpr = (ServerDeploymentPlanResultImpl) sgdpr.getServerResult(serverName);
if (sdpr == null) {
sdpr = new ServerDeploymentPlanResultImpl(serverName);
sgdpr.storeServerResult(serverName, sdpr);
}
sdpr.storeServerUpdateResult(actionId, sud);
}
}
}
return serverGroupResults;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"ServerGroupDeploymentPlanResult",
">",
"buildServerGroupResults",
"(",
"Map",
"<",
"UUID",
",",
"DeploymentActionResult",
">",
"deploymentActionResults",
")",
"{",
"Map",
"<",
"String",
",",
"ServerGroupDeploymentPlanResu... | Builds the data structures that show the effects of the plan by server group | [
"Builds",
"the",
"data",
"structures",
"that",
"show",
"the",
"effects",
"of",
"the",
"plan",
"by",
"server",
"group"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/helpers/domain/impl/DeploymentPlanResultImpl.java#L102-L133 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java | AbstractTransformationDescriptionBuilder.buildDefault | protected TransformationDescription buildDefault(final DiscardPolicy discardPolicy, boolean inherited, final AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry, List<String> discardedOperations) {
// Build attribute rules
final Map<String, AttributeTransformationDescription> attributes = registry.buildAttributes();
// Create operation transformers
final Map<String, OperationTransformer> operations = buildOperationTransformers(registry);
// Process children
final List<TransformationDescription> children = buildChildren();
if (discardPolicy == DiscardPolicy.NEVER) {
// TODO override more global operations?
if(! operations.containsKey(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, OperationTransformationRules.createWriteOperation(attributes));
}
if(! operations.containsKey(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, OperationTransformationRules.createUndefinedOperation(attributes));
}
}
// Create the description
Set<String> discarded = new HashSet<>();
discarded.addAll(discardedOperations);
return new TransformingDescription(pathElement, pathAddressTransformer, discardPolicy, inherited,
resourceTransformer, attributes, operations, children, discarded, dynamicDiscardPolicy);
} | java | protected TransformationDescription buildDefault(final DiscardPolicy discardPolicy, boolean inherited, final AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry, List<String> discardedOperations) {
// Build attribute rules
final Map<String, AttributeTransformationDescription> attributes = registry.buildAttributes();
// Create operation transformers
final Map<String, OperationTransformer> operations = buildOperationTransformers(registry);
// Process children
final List<TransformationDescription> children = buildChildren();
if (discardPolicy == DiscardPolicy.NEVER) {
// TODO override more global operations?
if(! operations.containsKey(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, OperationTransformationRules.createWriteOperation(attributes));
}
if(! operations.containsKey(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, OperationTransformationRules.createUndefinedOperation(attributes));
}
}
// Create the description
Set<String> discarded = new HashSet<>();
discarded.addAll(discardedOperations);
return new TransformingDescription(pathElement, pathAddressTransformer, discardPolicy, inherited,
resourceTransformer, attributes, operations, children, discarded, dynamicDiscardPolicy);
} | [
"protected",
"TransformationDescription",
"buildDefault",
"(",
"final",
"DiscardPolicy",
"discardPolicy",
",",
"boolean",
"inherited",
",",
"final",
"AttributeTransformationDescriptionBuilderImpl",
".",
"AttributeTransformationDescriptionBuilderRegistry",
"registry",
",",
"List",
... | Build the default transformation description.
@param discardPolicy the discard policy to use
@param inherited whether the definition is inherited
@param registry the attribute transformation rules for the resource
@param discardedOperations the discarded operations
@return the transformation description | [
"Build",
"the",
"default",
"transformation",
"description",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java#L87-L109 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java | AbstractTransformationDescriptionBuilder.buildOperationTransformers | protected Map<String, OperationTransformer> buildOperationTransformers(AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry) {
final Map<String, OperationTransformer> operations = new HashMap<String, OperationTransformer>();
for(final Map.Entry<String, OperationTransformationEntry> entry: operationTransformers.entrySet()) {
final OperationTransformer transformer = entry.getValue().getOperationTransformer(registry);
operations.put(entry.getKey(), transformer);
}
return operations;
} | java | protected Map<String, OperationTransformer> buildOperationTransformers(AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry) {
final Map<String, OperationTransformer> operations = new HashMap<String, OperationTransformer>();
for(final Map.Entry<String, OperationTransformationEntry> entry: operationTransformers.entrySet()) {
final OperationTransformer transformer = entry.getValue().getOperationTransformer(registry);
operations.put(entry.getKey(), transformer);
}
return operations;
} | [
"protected",
"Map",
"<",
"String",
",",
"OperationTransformer",
">",
"buildOperationTransformers",
"(",
"AttributeTransformationDescriptionBuilderImpl",
".",
"AttributeTransformationDescriptionBuilderRegistry",
"registry",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Operat... | Build the operation transformers.
@param registry the shared resource registry
@return the operation transformers | [
"Build",
"the",
"operation",
"transformers",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java#L117-L124 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java | AbstractTransformationDescriptionBuilder.buildChildren | protected List<TransformationDescription> buildChildren() {
if(children.isEmpty()) {
return Collections.emptyList();
}
final List<TransformationDescription> children = new ArrayList<TransformationDescription>();
for(final TransformationDescriptionBuilder builder : this.children) {
children.add(builder.build());
}
return children;
} | java | protected List<TransformationDescription> buildChildren() {
if(children.isEmpty()) {
return Collections.emptyList();
}
final List<TransformationDescription> children = new ArrayList<TransformationDescription>();
for(final TransformationDescriptionBuilder builder : this.children) {
children.add(builder.build());
}
return children;
} | [
"protected",
"List",
"<",
"TransformationDescription",
">",
"buildChildren",
"(",
")",
"{",
"if",
"(",
"children",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"final",
"List",
"<",
"TransformationDescrip... | Build all children.
@return the child descriptions | [
"Build",
"all",
"children",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java#L131-L140 | train |
wildfly/wildfly-core | remoting/subsystem/src/main/java/org/jboss/as/remoting/EndpointConfigFactory.java | EndpointConfigFactory.create | @Deprecated
public static OptionMap create(final ExpressionResolver resolver, final ModelNode model, final OptionMap defaults) throws OperationFailedException {
final OptionMap map = OptionMap.builder()
.addAll(defaults)
.set(Options.WORKER_READ_THREADS, RemotingSubsystemRootResource.WORKER_READ_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_CORE_THREADS, RemotingSubsystemRootResource.WORKER_TASK_CORE_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_KEEPALIVE, RemotingSubsystemRootResource.WORKER_TASK_KEEPALIVE.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_LIMIT, RemotingSubsystemRootResource.WORKER_TASK_LIMIT.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_MAX_THREADS, RemotingSubsystemRootResource.WORKER_TASK_MAX_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_WRITE_THREADS, RemotingSubsystemRootResource.WORKER_WRITE_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_READ_THREADS, RemotingSubsystemRootResource.WORKER_READ_THREADS.resolveModelAttribute(resolver, model).asInt())
.getMap();
return map;
} | java | @Deprecated
public static OptionMap create(final ExpressionResolver resolver, final ModelNode model, final OptionMap defaults) throws OperationFailedException {
final OptionMap map = OptionMap.builder()
.addAll(defaults)
.set(Options.WORKER_READ_THREADS, RemotingSubsystemRootResource.WORKER_READ_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_CORE_THREADS, RemotingSubsystemRootResource.WORKER_TASK_CORE_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_KEEPALIVE, RemotingSubsystemRootResource.WORKER_TASK_KEEPALIVE.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_LIMIT, RemotingSubsystemRootResource.WORKER_TASK_LIMIT.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_TASK_MAX_THREADS, RemotingSubsystemRootResource.WORKER_TASK_MAX_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_WRITE_THREADS, RemotingSubsystemRootResource.WORKER_WRITE_THREADS.resolveModelAttribute(resolver, model).asInt())
.set(Options.WORKER_READ_THREADS, RemotingSubsystemRootResource.WORKER_READ_THREADS.resolveModelAttribute(resolver, model).asInt())
.getMap();
return map;
} | [
"@",
"Deprecated",
"public",
"static",
"OptionMap",
"create",
"(",
"final",
"ExpressionResolver",
"resolver",
",",
"final",
"ModelNode",
"model",
",",
"final",
"OptionMap",
"defaults",
")",
"throws",
"OperationFailedException",
"{",
"final",
"OptionMap",
"map",
"=",... | creates option map for remoting connections
@param resolver
@param model
@param defaults
@return
@throws OperationFailedException
@deprecated configuring xnio worker options is no longer supported and should be replaced for referencing IO subsystem | [
"creates",
"option",
"map",
"for",
"remoting",
"connections"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/EndpointConfigFactory.java#L61-L74 | train |
wildfly/wildfly-core | elytron/src/main/java/org/wildfly/extension/elytron/ElytronSubsystemParser2_0.java | ElytronSubsystemParser2_0.getParserDescription | @Override
public PersistentResourceXMLDescription getParserDescription() {
return PersistentResourceXMLDescription.builder(ElytronExtension.SUBSYSTEM_PATH, getNameSpace())
.addAttribute(ElytronDefinition.DEFAULT_AUTHENTICATION_CONTEXT)
.addAttribute(ElytronDefinition.INITIAL_PROVIDERS)
.addAttribute(ElytronDefinition.FINAL_PROVIDERS)
.addAttribute(ElytronDefinition.DISALLOWED_PROVIDERS)
.addAttribute(ElytronDefinition.SECURITY_PROPERTIES, new AttributeParsers.PropertiesParser(null, SECURITY_PROPERTY, true), new AttributeMarshallers.PropertiesAttributeMarshaller(null, SECURITY_PROPERTY, true))
.addChild(getAuthenticationClientParser())
.addChild(getProviderParser())
.addChild(getAuditLoggingParser())
.addChild(getDomainParser())
.addChild(getRealmParser())
.addChild(getCredentialSecurityFactoryParser())
.addChild(getMapperParser())
.addChild(getHttpParser())
.addChild(getSaslParser())
.addChild(getTlsParser())
.addChild(decorator(CREDENTIAL_STORES).addChild(new CredentialStoreParser().parser))
.addChild(getDirContextParser())
.addChild(getPolicyParser())
.build();
} | java | @Override
public PersistentResourceXMLDescription getParserDescription() {
return PersistentResourceXMLDescription.builder(ElytronExtension.SUBSYSTEM_PATH, getNameSpace())
.addAttribute(ElytronDefinition.DEFAULT_AUTHENTICATION_CONTEXT)
.addAttribute(ElytronDefinition.INITIAL_PROVIDERS)
.addAttribute(ElytronDefinition.FINAL_PROVIDERS)
.addAttribute(ElytronDefinition.DISALLOWED_PROVIDERS)
.addAttribute(ElytronDefinition.SECURITY_PROPERTIES, new AttributeParsers.PropertiesParser(null, SECURITY_PROPERTY, true), new AttributeMarshallers.PropertiesAttributeMarshaller(null, SECURITY_PROPERTY, true))
.addChild(getAuthenticationClientParser())
.addChild(getProviderParser())
.addChild(getAuditLoggingParser())
.addChild(getDomainParser())
.addChild(getRealmParser())
.addChild(getCredentialSecurityFactoryParser())
.addChild(getMapperParser())
.addChild(getHttpParser())
.addChild(getSaslParser())
.addChild(getTlsParser())
.addChild(decorator(CREDENTIAL_STORES).addChild(new CredentialStoreParser().parser))
.addChild(getDirContextParser())
.addChild(getPolicyParser())
.build();
} | [
"@",
"Override",
"public",
"PersistentResourceXMLDescription",
"getParserDescription",
"(",
")",
"{",
"return",
"PersistentResourceXMLDescription",
".",
"builder",
"(",
"ElytronExtension",
".",
"SUBSYSTEM_PATH",
",",
"getNameSpace",
"(",
")",
")",
".",
"addAttribute",
"... | at this point definition below is not really needed as it is the same as for 1.1, but it is here as place holder when subsystem parser evolves. | [
"at",
"this",
"point",
"definition",
"below",
"is",
"not",
"really",
"needed",
"as",
"it",
"is",
"the",
"same",
"as",
"for",
"1",
".",
"1",
"but",
"it",
"is",
"here",
"as",
"place",
"holder",
"when",
"subsystem",
"parser",
"evolves",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/ElytronSubsystemParser2_0.java#L43-L65 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java | WritableAuthorizerConfiguration.reset | public synchronized void reset() {
this.authorizerDescription = StandardRBACAuthorizer.AUTHORIZER_DESCRIPTION;
this.useIdentityRoles = this.nonFacadeMBeansSensitive = false;
this.roleMappings = new HashMap<String, RoleMappingImpl>();
RoleMaps oldRoleMaps = this.roleMaps;
this.roleMaps = new RoleMaps(authorizerDescription.getStandardRoles(), Collections.<String, ScopedRole>emptyMap());
for (ScopedRole role : oldRoleMaps.scopedRoles.values()) {
for (ScopedRoleListener listener : scopedRoleListeners) {
try {
listener.scopedRoleRemoved(role);
} catch (Exception ignored) {
// TODO log an ERROR
}
}
}
} | java | public synchronized void reset() {
this.authorizerDescription = StandardRBACAuthorizer.AUTHORIZER_DESCRIPTION;
this.useIdentityRoles = this.nonFacadeMBeansSensitive = false;
this.roleMappings = new HashMap<String, RoleMappingImpl>();
RoleMaps oldRoleMaps = this.roleMaps;
this.roleMaps = new RoleMaps(authorizerDescription.getStandardRoles(), Collections.<String, ScopedRole>emptyMap());
for (ScopedRole role : oldRoleMaps.scopedRoles.values()) {
for (ScopedRoleListener listener : scopedRoleListeners) {
try {
listener.scopedRoleRemoved(role);
} catch (Exception ignored) {
// TODO log an ERROR
}
}
}
} | [
"public",
"synchronized",
"void",
"reset",
"(",
")",
"{",
"this",
".",
"authorizerDescription",
"=",
"StandardRBACAuthorizer",
".",
"AUTHORIZER_DESCRIPTION",
";",
"this",
".",
"useIdentityRoles",
"=",
"this",
".",
"nonFacadeMBeansSensitive",
"=",
"false",
";",
"this... | Reset the internal state of this object back to what it originally was.
Used then reloading a server or in a slave host controller following a post-boot reconnect
to the master. | [
"Reset",
"the",
"internal",
"state",
"of",
"this",
"object",
"back",
"to",
"what",
"it",
"originally",
"was",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java#L72-L87 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java | WritableAuthorizerConfiguration.addRoleMapping | public synchronized void addRoleMapping(final String roleName) {
HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
if (newRoles.containsKey(roleName) == false) {
newRoles.put(roleName, new RoleMappingImpl(roleName));
roleMappings = Collections.unmodifiableMap(newRoles);
}
} | java | public synchronized void addRoleMapping(final String roleName) {
HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
if (newRoles.containsKey(roleName) == false) {
newRoles.put(roleName, new RoleMappingImpl(roleName));
roleMappings = Collections.unmodifiableMap(newRoles);
}
} | [
"public",
"synchronized",
"void",
"addRoleMapping",
"(",
"final",
"String",
"roleName",
")",
"{",
"HashMap",
"<",
"String",
",",
"RoleMappingImpl",
">",
"newRoles",
"=",
"new",
"HashMap",
"<",
"String",
",",
"RoleMappingImpl",
">",
"(",
"roleMappings",
")",
";... | Adds a new role to the list of defined roles.
@param roleName - The name of the role being added. | [
"Adds",
"a",
"new",
"role",
"to",
"the",
"list",
"of",
"defined",
"roles",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java#L176-L182 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java | WritableAuthorizerConfiguration.removeRoleMapping | public synchronized Object removeRoleMapping(final String roleName) {
/*
* Would not expect this to happen during boot so don't offer the 'immediate' optimisation.
*/
HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
if (newRoles.containsKey(roleName)) {
RoleMappingImpl removed = newRoles.remove(roleName);
Object removalKey = new Object();
removedRoles.put(removalKey, removed);
roleMappings = Collections.unmodifiableMap(newRoles);
return removalKey;
}
return null;
} | java | public synchronized Object removeRoleMapping(final String roleName) {
/*
* Would not expect this to happen during boot so don't offer the 'immediate' optimisation.
*/
HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
if (newRoles.containsKey(roleName)) {
RoleMappingImpl removed = newRoles.remove(roleName);
Object removalKey = new Object();
removedRoles.put(removalKey, removed);
roleMappings = Collections.unmodifiableMap(newRoles);
return removalKey;
}
return null;
} | [
"public",
"synchronized",
"Object",
"removeRoleMapping",
"(",
"final",
"String",
"roleName",
")",
"{",
"/*\n * Would not expect this to happen during boot so don't offer the 'immediate' optimisation.\n */",
"HashMap",
"<",
"String",
",",
"RoleMappingImpl",
">",
"new... | Remove a role from the list of defined roles.
@param roleName - The name of the role to be removed.
@return A key that can be used to undo the removal. | [
"Remove",
"a",
"role",
"from",
"the",
"list",
"of",
"defined",
"roles",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java#L190-L205 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java | WritableAuthorizerConfiguration.undoRoleMappingRemove | public synchronized boolean undoRoleMappingRemove(final Object removalKey) {
HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
RoleMappingImpl toRestore = removedRoles.remove(removalKey);
if (toRestore != null && newRoles.containsKey(toRestore.getName()) == false) {
newRoles.put(toRestore.getName(), toRestore);
roleMappings = Collections.unmodifiableMap(newRoles);
return true;
}
return false;
} | java | public synchronized boolean undoRoleMappingRemove(final Object removalKey) {
HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings);
RoleMappingImpl toRestore = removedRoles.remove(removalKey);
if (toRestore != null && newRoles.containsKey(toRestore.getName()) == false) {
newRoles.put(toRestore.getName(), toRestore);
roleMappings = Collections.unmodifiableMap(newRoles);
return true;
}
return false;
} | [
"public",
"synchronized",
"boolean",
"undoRoleMappingRemove",
"(",
"final",
"Object",
"removalKey",
")",
"{",
"HashMap",
"<",
"String",
",",
"RoleMappingImpl",
">",
"newRoles",
"=",
"new",
"HashMap",
"<",
"String",
",",
"RoleMappingImpl",
">",
"(",
"roleMappings",... | Undo a prior removal using the supplied undo key.
@param removalKey - The key returned from the call to removeRoleMapping.
@return true if the undo was successful, false otherwise. | [
"Undo",
"a",
"prior",
"removal",
"using",
"the",
"supplied",
"undo",
"key",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/access/management/WritableAuthorizerConfiguration.java#L213-L223 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/operations/coordination/ServerOperationResolver.java | ServerOperationResolver.getDeploymentOverlayOperations | private Map<Set<ServerIdentity>, ModelNode> getDeploymentOverlayOperations(ModelNode operation,
ModelNode host) {
final PathAddress realAddress = PathAddress.pathAddress(operation.get(OP_ADDR));
if (realAddress.size() == 0 && COMPOSITE.equals(operation.get(OP).asString())) {
//We have a composite operation resulting from a transformation to redeploy affected deployments
//See redeploying deployments affected by an overlay.
ModelNode serverOp = operation.clone();
Map<ServerIdentity, Operations.CompositeOperationBuilder> composite = new HashMap<>();
for (ModelNode step : serverOp.get(STEPS).asList()) {
ModelNode newStep = step.clone();
String groupName = PathAddress.pathAddress(step.get(OP_ADDR)).getElement(0).getValue();
newStep.get(OP_ADDR).set(PathAddress.pathAddress(step.get(OP_ADDR)).subAddress(1).toModelNode());
Set<ServerIdentity> servers = getServersForGroup(groupName, host, localHostName, serverProxies);
for(ServerIdentity server : servers) {
if(!composite.containsKey(server)) {
composite.put(server, Operations.CompositeOperationBuilder.create());
}
composite.get(server).addStep(newStep);
}
if(!servers.isEmpty()) {
newStep.get(OP_ADDR).set(PathAddress.pathAddress(step.get(OP_ADDR)).subAddress(1).toModelNode());
}
}
if(!composite.isEmpty()) {
Map<Set<ServerIdentity>, ModelNode> result = new HashMap<>();
for(Entry<ServerIdentity, Operations.CompositeOperationBuilder> entry : composite.entrySet()) {
result.put(Collections.singleton(entry.getKey()), entry.getValue().build().getOperation());
}
return result;
}
return Collections.emptyMap();
}
final Set<ServerIdentity> allServers = getAllRunningServers(host, localHostName, serverProxies);
return Collections.singletonMap(allServers, operation.clone());
} | java | private Map<Set<ServerIdentity>, ModelNode> getDeploymentOverlayOperations(ModelNode operation,
ModelNode host) {
final PathAddress realAddress = PathAddress.pathAddress(operation.get(OP_ADDR));
if (realAddress.size() == 0 && COMPOSITE.equals(operation.get(OP).asString())) {
//We have a composite operation resulting from a transformation to redeploy affected deployments
//See redeploying deployments affected by an overlay.
ModelNode serverOp = operation.clone();
Map<ServerIdentity, Operations.CompositeOperationBuilder> composite = new HashMap<>();
for (ModelNode step : serverOp.get(STEPS).asList()) {
ModelNode newStep = step.clone();
String groupName = PathAddress.pathAddress(step.get(OP_ADDR)).getElement(0).getValue();
newStep.get(OP_ADDR).set(PathAddress.pathAddress(step.get(OP_ADDR)).subAddress(1).toModelNode());
Set<ServerIdentity> servers = getServersForGroup(groupName, host, localHostName, serverProxies);
for(ServerIdentity server : servers) {
if(!composite.containsKey(server)) {
composite.put(server, Operations.CompositeOperationBuilder.create());
}
composite.get(server).addStep(newStep);
}
if(!servers.isEmpty()) {
newStep.get(OP_ADDR).set(PathAddress.pathAddress(step.get(OP_ADDR)).subAddress(1).toModelNode());
}
}
if(!composite.isEmpty()) {
Map<Set<ServerIdentity>, ModelNode> result = new HashMap<>();
for(Entry<ServerIdentity, Operations.CompositeOperationBuilder> entry : composite.entrySet()) {
result.put(Collections.singleton(entry.getKey()), entry.getValue().build().getOperation());
}
return result;
}
return Collections.emptyMap();
}
final Set<ServerIdentity> allServers = getAllRunningServers(host, localHostName, serverProxies);
return Collections.singletonMap(allServers, operation.clone());
} | [
"private",
"Map",
"<",
"Set",
"<",
"ServerIdentity",
">",
",",
"ModelNode",
">",
"getDeploymentOverlayOperations",
"(",
"ModelNode",
"operation",
",",
"ModelNode",
"host",
")",
"{",
"final",
"PathAddress",
"realAddress",
"=",
"PathAddress",
".",
"pathAddress",
"("... | Convert an operation for deployment overlays to be executed on local servers.
Since this might be called in the case of redeployment of affected deployments, we need to take into account
the composite op resulting from such a transformation
@see AffectedDeploymentOverlay#redeployLinksAndTransformOperationForDomain
@param operation
@param host
@return | [
"Convert",
"an",
"operation",
"for",
"deployment",
"overlays",
"to",
"be",
"executed",
"on",
"local",
"servers",
".",
"Since",
"this",
"might",
"be",
"called",
"in",
"the",
"case",
"of",
"redeployment",
"of",
"affected",
"deployments",
"we",
"need",
"to",
"t... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/coordination/ServerOperationResolver.java#L350-L384 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/ServerLogsPanel.java | ServerLogsPanel.isLogDownloadAvailable | public static boolean isLogDownloadAvailable(CliGuiContext cliGuiCtx) {
ModelNode readOps = null;
try {
readOps = cliGuiCtx.getExecutor().doCommand("/subsystem=logging:read-children-types");
} catch (CommandFormatException | IOException e) {
return false;
}
if (!readOps.get("result").isDefined()) return false;
for (ModelNode op: readOps.get("result").asList()) {
if ("log-file".equals(op.asString())) return true;
}
return false;
} | java | public static boolean isLogDownloadAvailable(CliGuiContext cliGuiCtx) {
ModelNode readOps = null;
try {
readOps = cliGuiCtx.getExecutor().doCommand("/subsystem=logging:read-children-types");
} catch (CommandFormatException | IOException e) {
return false;
}
if (!readOps.get("result").isDefined()) return false;
for (ModelNode op: readOps.get("result").asList()) {
if ("log-file".equals(op.asString())) return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isLogDownloadAvailable",
"(",
"CliGuiContext",
"cliGuiCtx",
")",
"{",
"ModelNode",
"readOps",
"=",
"null",
";",
"try",
"{",
"readOps",
"=",
"cliGuiCtx",
".",
"getExecutor",
"(",
")",
".",
"doCommand",
"(",
"\"/subsystem=logging:read... | Does the server support log downloads?
@param cliGuiCtx The context.
@return <code>true</code> if the server supports log downloads,
<code>false</code> otherwise. | [
"Does",
"the",
"server",
"support",
"log",
"downloads?"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/ServerLogsPanel.java#L80-L92 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/interfaces/InetAddressUtil.java | InetAddressUtil.getLocalHost | public static InetAddress getLocalHost() throws UnknownHostException {
InetAddress addr;
try {
addr = InetAddress.getLocalHost();
} catch (ArrayIndexOutOfBoundsException e) { //this is workaround for mac osx bug see AS7-3223 and JGRP-1404
addr = InetAddress.getByName(null);
}
return addr;
} | java | public static InetAddress getLocalHost() throws UnknownHostException {
InetAddress addr;
try {
addr = InetAddress.getLocalHost();
} catch (ArrayIndexOutOfBoundsException e) { //this is workaround for mac osx bug see AS7-3223 and JGRP-1404
addr = InetAddress.getByName(null);
}
return addr;
} | [
"public",
"static",
"InetAddress",
"getLocalHost",
"(",
")",
"throws",
"UnknownHostException",
"{",
"InetAddress",
"addr",
";",
"try",
"{",
"addr",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
";",
"}",
"catch",
"(",
"ArrayIndexOutOfBoundsException",
"e",
... | Methods returns InetAddress for localhost
@return InetAddress of the localhost
@throws UnknownHostException if localhost could not be resolved | [
"Methods",
"returns",
"InetAddress",
"for",
"localhost"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/interfaces/InetAddressUtil.java#L44-L52 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java | ConfigurationFile.getBootFile | public File getBootFile() {
if (bootFile == null) {
synchronized (this) {
if (bootFile == null) {
if (bootFileReset) {
//Reset the done bootup and the sequence, so that the old file we are reloading from
// overwrites the main file on successful boot, and history is reset as when booting new
doneBootup.set(false);
sequence.set(0);
}
// If it's a reload with no new boot file name and we're persisting our config, we boot from mainFile,
// as that's where we persist
if (bootFileReset && !interactionPolicy.isReadOnly() && newReloadBootFileName == null) {
// we boot from mainFile
bootFile = mainFile;
} else {
// It's either first boot, or a reload where we're not persisting our config or with a new boot file.
// So we need to figure out which file we're meant to boot from
String bootFileName = this.bootFileName;
if (newReloadBootFileName != null) {
//A non-null new boot file on reload takes precedence over the reloadUsingLast functionality
//A new boot file was specified. Use that and reset the new name to null
bootFileName = newReloadBootFileName;
newReloadBootFileName = null;
} else if (interactionPolicy.isReadOnly() && reloadUsingLast) {
//If we were reloaded, and it is not a persistent configuration we want to use the last from the history
bootFileName = LAST;
}
boolean usingRawFile = bootFileName.equals(rawFileName);
if (usingRawFile) {
bootFile = mainFile;
} else {
bootFile = determineBootFile(configurationDir, bootFileName);
try {
bootFile = bootFile.getCanonicalFile();
} catch (IOException ioe) {
throw ControllerLogger.ROOT_LOGGER.canonicalBootFileNotFound(ioe, bootFile);
}
}
if (!bootFile.exists()) {
if (!usingRawFile) { // TODO there's no reason usingRawFile should be an exception,
// but the test infrastructure stuff is built around an assumption
// that ConfigurationFile doesn't fail if test files are not
// in the normal spot
if (bootFileReset || interactionPolicy.isRequireExisting()) {
throw ControllerLogger.ROOT_LOGGER.fileNotFound(bootFile.getAbsolutePath());
}
}
// Create it for the NEW and DISCARD cases
if (!bootFileReset && !interactionPolicy.isRequireExisting()) {
createBootFile(bootFile);
}
} else if (!bootFileReset) {
if (interactionPolicy.isRejectExisting() && bootFile.length() > 0) {
throw ControllerLogger.ROOT_LOGGER.rejectEmptyConfig(bootFile.getAbsolutePath());
} else if (interactionPolicy.isRemoveExisting() && bootFile.length() > 0) {
if (!bootFile.delete()) {
throw ControllerLogger.ROOT_LOGGER.cannotDelete(bootFile.getAbsoluteFile());
}
createBootFile(bootFile);
}
} // else after first boot we want the file to exist
}
}
}
}
return bootFile;
} | java | public File getBootFile() {
if (bootFile == null) {
synchronized (this) {
if (bootFile == null) {
if (bootFileReset) {
//Reset the done bootup and the sequence, so that the old file we are reloading from
// overwrites the main file on successful boot, and history is reset as when booting new
doneBootup.set(false);
sequence.set(0);
}
// If it's a reload with no new boot file name and we're persisting our config, we boot from mainFile,
// as that's where we persist
if (bootFileReset && !interactionPolicy.isReadOnly() && newReloadBootFileName == null) {
// we boot from mainFile
bootFile = mainFile;
} else {
// It's either first boot, or a reload where we're not persisting our config or with a new boot file.
// So we need to figure out which file we're meant to boot from
String bootFileName = this.bootFileName;
if (newReloadBootFileName != null) {
//A non-null new boot file on reload takes precedence over the reloadUsingLast functionality
//A new boot file was specified. Use that and reset the new name to null
bootFileName = newReloadBootFileName;
newReloadBootFileName = null;
} else if (interactionPolicy.isReadOnly() && reloadUsingLast) {
//If we were reloaded, and it is not a persistent configuration we want to use the last from the history
bootFileName = LAST;
}
boolean usingRawFile = bootFileName.equals(rawFileName);
if (usingRawFile) {
bootFile = mainFile;
} else {
bootFile = determineBootFile(configurationDir, bootFileName);
try {
bootFile = bootFile.getCanonicalFile();
} catch (IOException ioe) {
throw ControllerLogger.ROOT_LOGGER.canonicalBootFileNotFound(ioe, bootFile);
}
}
if (!bootFile.exists()) {
if (!usingRawFile) { // TODO there's no reason usingRawFile should be an exception,
// but the test infrastructure stuff is built around an assumption
// that ConfigurationFile doesn't fail if test files are not
// in the normal spot
if (bootFileReset || interactionPolicy.isRequireExisting()) {
throw ControllerLogger.ROOT_LOGGER.fileNotFound(bootFile.getAbsolutePath());
}
}
// Create it for the NEW and DISCARD cases
if (!bootFileReset && !interactionPolicy.isRequireExisting()) {
createBootFile(bootFile);
}
} else if (!bootFileReset) {
if (interactionPolicy.isRejectExisting() && bootFile.length() > 0) {
throw ControllerLogger.ROOT_LOGGER.rejectEmptyConfig(bootFile.getAbsolutePath());
} else if (interactionPolicy.isRemoveExisting() && bootFile.length() > 0) {
if (!bootFile.delete()) {
throw ControllerLogger.ROOT_LOGGER.cannotDelete(bootFile.getAbsoluteFile());
}
createBootFile(bootFile);
}
} // else after first boot we want the file to exist
}
}
}
}
return bootFile;
} | [
"public",
"File",
"getBootFile",
"(",
")",
"{",
"if",
"(",
"bootFile",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"bootFile",
"==",
"null",
")",
"{",
"if",
"(",
"bootFileReset",
")",
"{",
"//Reset the done bootup and the sequ... | Gets the file from which boot operations should be parsed.
@return the file. Will not be {@code null} | [
"Gets",
"the",
"file",
"from",
"which",
"boot",
"operations",
"should",
"be",
"parsed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java#L217-L287 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java | ConfigurationFile.successfulBoot | void successfulBoot() throws ConfigurationPersistenceException {
synchronized (this) {
if (doneBootup.get()) {
return;
}
final File copySource;
if (!interactionPolicy.isReadOnly()) {
copySource = mainFile;
} else {
if ( FilePersistenceUtils.isParentFolderWritable(mainFile) ) {
copySource = new File(mainFile.getParentFile(), mainFile.getName() + ".boot");
} else{
copySource = new File(configurationDir, mainFile.getName() + ".boot");
}
FilePersistenceUtils.deleteFile(copySource);
}
try {
if (!bootFile.equals(copySource)) {
FilePersistenceUtils.copyFile(bootFile, copySource);
}
createHistoryDirectory();
final File historyBase = new File(historyRoot, mainFile.getName());
lastFile = addSuffixToFile(historyBase, LAST);
final File boot = addSuffixToFile(historyBase, BOOT);
final File initial = addSuffixToFile(historyBase, INITIAL);
if (!initial.exists()) {
FilePersistenceUtils.copyFile(copySource, initial);
}
FilePersistenceUtils.copyFile(copySource, lastFile);
FilePersistenceUtils.copyFile(copySource, boot);
} catch (IOException e) {
throw ControllerLogger.ROOT_LOGGER.failedToCreateConfigurationBackup(e, bootFile);
} finally {
if (interactionPolicy.isReadOnly()) {
//Delete the temporary file
try {
FilePersistenceUtils.deleteFile(copySource);
} catch (Exception ignore) {
}
}
}
doneBootup.set(true);
}
} | java | void successfulBoot() throws ConfigurationPersistenceException {
synchronized (this) {
if (doneBootup.get()) {
return;
}
final File copySource;
if (!interactionPolicy.isReadOnly()) {
copySource = mainFile;
} else {
if ( FilePersistenceUtils.isParentFolderWritable(mainFile) ) {
copySource = new File(mainFile.getParentFile(), mainFile.getName() + ".boot");
} else{
copySource = new File(configurationDir, mainFile.getName() + ".boot");
}
FilePersistenceUtils.deleteFile(copySource);
}
try {
if (!bootFile.equals(copySource)) {
FilePersistenceUtils.copyFile(bootFile, copySource);
}
createHistoryDirectory();
final File historyBase = new File(historyRoot, mainFile.getName());
lastFile = addSuffixToFile(historyBase, LAST);
final File boot = addSuffixToFile(historyBase, BOOT);
final File initial = addSuffixToFile(historyBase, INITIAL);
if (!initial.exists()) {
FilePersistenceUtils.copyFile(copySource, initial);
}
FilePersistenceUtils.copyFile(copySource, lastFile);
FilePersistenceUtils.copyFile(copySource, boot);
} catch (IOException e) {
throw ControllerLogger.ROOT_LOGGER.failedToCreateConfigurationBackup(e, bootFile);
} finally {
if (interactionPolicy.isReadOnly()) {
//Delete the temporary file
try {
FilePersistenceUtils.deleteFile(copySource);
} catch (Exception ignore) {
}
}
}
doneBootup.set(true);
}
} | [
"void",
"successfulBoot",
"(",
")",
"throws",
"ConfigurationPersistenceException",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"doneBootup",
".",
"get",
"(",
")",
")",
"{",
"return",
";",
"}",
"final",
"File",
"copySource",
";",
"if",
"(",
"!",
... | Notification that boot has completed successfully and the configuration history should be updated | [
"Notification",
"that",
"boot",
"has",
"completed",
"successfully",
"and",
"the",
"configuration",
"history",
"should",
"be",
"updated"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java#L483-L533 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java | ConfigurationFile.backup | void backup() throws ConfigurationPersistenceException {
if (!doneBootup.get()) {
return;
}
try {
if (!interactionPolicy.isReadOnly()) {
//Move the main file to the versioned history
moveFile(mainFile, getVersionedFile(mainFile));
} else {
//Copy the Last file to the versioned history
moveFile(lastFile, getVersionedFile(mainFile));
}
int seq = sequence.get();
// delete unwanted backup files
int currentHistoryLength = getInteger(CURRENT_HISTORY_LENGTH_PROPERTY, CURRENT_HISTORY_LENGTH, 0);
if (seq > currentHistoryLength) {
for (int k = seq - currentHistoryLength; k > 0; k--) {
File delete = getVersionedFile(mainFile, k);
if (! delete.exists()) {
break;
}
delete.delete();
}
}
} catch (IOException e) {
throw ControllerLogger.ROOT_LOGGER.failedToBackup(e, mainFile);
}
} | java | void backup() throws ConfigurationPersistenceException {
if (!doneBootup.get()) {
return;
}
try {
if (!interactionPolicy.isReadOnly()) {
//Move the main file to the versioned history
moveFile(mainFile, getVersionedFile(mainFile));
} else {
//Copy the Last file to the versioned history
moveFile(lastFile, getVersionedFile(mainFile));
}
int seq = sequence.get();
// delete unwanted backup files
int currentHistoryLength = getInteger(CURRENT_HISTORY_LENGTH_PROPERTY, CURRENT_HISTORY_LENGTH, 0);
if (seq > currentHistoryLength) {
for (int k = seq - currentHistoryLength; k > 0; k--) {
File delete = getVersionedFile(mainFile, k);
if (! delete.exists()) {
break;
}
delete.delete();
}
}
} catch (IOException e) {
throw ControllerLogger.ROOT_LOGGER.failedToBackup(e, mainFile);
}
} | [
"void",
"backup",
"(",
")",
"throws",
"ConfigurationPersistenceException",
"{",
"if",
"(",
"!",
"doneBootup",
".",
"get",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"if",
"(",
"!",
"interactionPolicy",
".",
"isReadOnly",
"(",
")",
")",
"{",
"/... | Backup the current version of the configuration to the versioned configuration history | [
"Backup",
"the",
"current",
"version",
"of",
"the",
"configuration",
"to",
"the",
"versioned",
"configuration",
"history"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java#L537-L564 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java | ConfigurationFile.commitTempFile | void commitTempFile(File temp) throws ConfigurationPersistenceException {
if (!doneBootup.get()) {
return;
}
if (!interactionPolicy.isReadOnly()) {
FilePersistenceUtils.moveTempFileToMain(temp, mainFile);
} else {
FilePersistenceUtils.moveTempFileToMain(temp, lastFile);
}
} | java | void commitTempFile(File temp) throws ConfigurationPersistenceException {
if (!doneBootup.get()) {
return;
}
if (!interactionPolicy.isReadOnly()) {
FilePersistenceUtils.moveTempFileToMain(temp, mainFile);
} else {
FilePersistenceUtils.moveTempFileToMain(temp, lastFile);
}
} | [
"void",
"commitTempFile",
"(",
"File",
"temp",
")",
"throws",
"ConfigurationPersistenceException",
"{",
"if",
"(",
"!",
"doneBootup",
".",
"get",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"interactionPolicy",
".",
"isReadOnly",
"(",
")",
")",... | Commit the contents of the given temp file to either the main file, or, if we are not persisting
to the main file, to the .last file in the configuration history
@param temp temp file containing the latest configuration. Will not be {@code null}
@throws ConfigurationPersistenceException | [
"Commit",
"the",
"contents",
"of",
"the",
"given",
"temp",
"file",
"to",
"either",
"the",
"main",
"file",
"or",
"if",
"we",
"are",
"not",
"persisting",
"to",
"the",
"main",
"file",
"to",
"the",
".",
"last",
"file",
"in",
"the",
"configuration",
"history"... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java#L572-L581 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java | ConfigurationFile.fileWritten | void fileWritten() throws ConfigurationPersistenceException {
if (!doneBootup.get() || interactionPolicy.isReadOnly()) {
return;
}
try {
FilePersistenceUtils.copyFile(mainFile, lastFile);
} catch (IOException e) {
throw ControllerLogger.ROOT_LOGGER.failedToBackup(e, mainFile);
}
} | java | void fileWritten() throws ConfigurationPersistenceException {
if (!doneBootup.get() || interactionPolicy.isReadOnly()) {
return;
}
try {
FilePersistenceUtils.copyFile(mainFile, lastFile);
} catch (IOException e) {
throw ControllerLogger.ROOT_LOGGER.failedToBackup(e, mainFile);
}
} | [
"void",
"fileWritten",
"(",
")",
"throws",
"ConfigurationPersistenceException",
"{",
"if",
"(",
"!",
"doneBootup",
".",
"get",
"(",
")",
"||",
"interactionPolicy",
".",
"isReadOnly",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"FilePersistenceUtils",
... | Notification that the configuration has been written, and its current content should be stored to the .last file | [
"Notification",
"that",
"the",
"configuration",
"has",
"been",
"written",
"and",
"its",
"current",
"content",
"should",
"be",
"stored",
"to",
"the",
".",
"last",
"file"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java#L584-L593 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java | ConfigurationFile.deleteRecursive | private void deleteRecursive(final File file) {
if (file.isDirectory()) {
final String[] files = file.list();
if (files != null) {
for (String name : files) {
deleteRecursive(new File(file, name));
}
}
}
if (!file.delete()) {
ControllerLogger.ROOT_LOGGER.cannotDeleteFileOrDirectory(file);
}
} | java | private void deleteRecursive(final File file) {
if (file.isDirectory()) {
final String[] files = file.list();
if (files != null) {
for (String name : files) {
deleteRecursive(new File(file, name));
}
}
}
if (!file.delete()) {
ControllerLogger.ROOT_LOGGER.cannotDeleteFileOrDirectory(file);
}
} | [
"private",
"void",
"deleteRecursive",
"(",
"final",
"File",
"file",
")",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"final",
"String",
"[",
"]",
"files",
"=",
"file",
".",
"list",
"(",
")",
";",
"if",
"(",
"files",
"!=",
"null"... | note, this just logs an error and doesn't throw as its only used to remove old configuration files, and shouldn't stop boot | [
"note",
"this",
"just",
"logs",
"an",
"error",
"and",
"doesn",
"t",
"throw",
"as",
"its",
"only",
"used",
"to",
"remove",
"old",
"configuration",
"files",
"and",
"shouldn",
"t",
"stop",
"boot"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/persistence/ConfigurationFile.java#L714-L727 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/RestartParentResourceRemoveHandler.java | RestartParentResourceRemoveHandler.updateModel | protected void updateModel(final OperationContext context, final ModelNode operation) throws OperationFailedException {
// verify that the resource exist before removing it
context.readResource(PathAddress.EMPTY_ADDRESS, false);
Resource resource = context.removeResource(PathAddress.EMPTY_ADDRESS);
recordCapabilitiesAndRequirements(context, operation, resource);
} | java | protected void updateModel(final OperationContext context, final ModelNode operation) throws OperationFailedException {
// verify that the resource exist before removing it
context.readResource(PathAddress.EMPTY_ADDRESS, false);
Resource resource = context.removeResource(PathAddress.EMPTY_ADDRESS);
recordCapabilitiesAndRequirements(context, operation, resource);
} | [
"protected",
"void",
"updateModel",
"(",
"final",
"OperationContext",
"context",
",",
"final",
"ModelNode",
"operation",
")",
"throws",
"OperationFailedException",
"{",
"// verify that the resource exist before removing it",
"context",
".",
"readResource",
"(",
"PathAddress",... | Performs the update to the persistent configuration model. This default implementation simply removes
the targeted resource.
@param context the operation context
@param operation the operation
@throws OperationFailedException if there is a problem updating the model | [
"Performs",
"the",
"update",
"to",
"the",
"persistent",
"configuration",
"model",
".",
"This",
"default",
"implementation",
"simply",
"removes",
"the",
"targeted",
"resource",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/RestartParentResourceRemoveHandler.java#L62-L67 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java | AbstractOperationContext.executeOperation | ResultAction executeOperation() {
assert isControllingThread();
try {
/** Execution has begun */
executing = true;
processStages();
if (resultAction == ResultAction.KEEP) {
report(MessageSeverity.INFO, ControllerLogger.ROOT_LOGGER.operationSucceeded());
} else {
report(MessageSeverity.INFO, ControllerLogger.ROOT_LOGGER.operationRollingBack());
}
} catch (RuntimeException e) {
handleUncaughtException(e);
ControllerLogger.MGMT_OP_LOGGER.unexpectedOperationExecutionException(e, controllerOperations);
} finally {
// On failure close any attached response streams
if (resultAction != ResultAction.KEEP && !isBooting()) {
synchronized (this) {
if (responseStreams != null) {
int i = 0;
for (OperationResponse.StreamEntry is : responseStreams.values()) {
try {
is.getStream().close();
} catch (Exception e) {
ControllerLogger.MGMT_OP_LOGGER.debugf(e, "Failed closing stream at index %d", i);
}
i++;
}
responseStreams.clear();
}
}
}
}
return resultAction;
} | java | ResultAction executeOperation() {
assert isControllingThread();
try {
/** Execution has begun */
executing = true;
processStages();
if (resultAction == ResultAction.KEEP) {
report(MessageSeverity.INFO, ControllerLogger.ROOT_LOGGER.operationSucceeded());
} else {
report(MessageSeverity.INFO, ControllerLogger.ROOT_LOGGER.operationRollingBack());
}
} catch (RuntimeException e) {
handleUncaughtException(e);
ControllerLogger.MGMT_OP_LOGGER.unexpectedOperationExecutionException(e, controllerOperations);
} finally {
// On failure close any attached response streams
if (resultAction != ResultAction.KEEP && !isBooting()) {
synchronized (this) {
if (responseStreams != null) {
int i = 0;
for (OperationResponse.StreamEntry is : responseStreams.values()) {
try {
is.getStream().close();
} catch (Exception e) {
ControllerLogger.MGMT_OP_LOGGER.debugf(e, "Failed closing stream at index %d", i);
}
i++;
}
responseStreams.clear();
}
}
}
}
return resultAction;
} | [
"ResultAction",
"executeOperation",
"(",
")",
"{",
"assert",
"isControllingThread",
"(",
")",
";",
"try",
"{",
"/** Execution has begun */",
"executing",
"=",
"true",
";",
"processStages",
"(",
")",
";",
"if",
"(",
"resultAction",
"==",
"ResultAction",
".",
"KEE... | Package-protected method used to initiate operation execution.
@return the result action | [
"Package",
"-",
"protected",
"method",
"used",
"to",
"initiate",
"operation",
"execution",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java#L460-L499 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java | AbstractOperationContext.logAuditRecord | void logAuditRecord() {
trackConfigurationChange();
if (!auditLogged) {
try {
AccessAuditContext accessContext = SecurityActions.currentAccessAuditContext();
Caller caller = getCaller();
auditLogger.log(
isReadOnly(),
resultAction,
caller == null ? null : caller.getName(),
accessContext == null ? null : accessContext.getDomainUuid(),
accessContext == null ? null : accessContext.getAccessMechanism(),
accessContext == null ? null : accessContext.getRemoteAddress(),
getModel(),
controllerOperations);
auditLogged = true;
} catch (Exception e) {
ControllerLogger.MGMT_OP_LOGGER.failedToUpdateAuditLog(e);
}
}
} | java | void logAuditRecord() {
trackConfigurationChange();
if (!auditLogged) {
try {
AccessAuditContext accessContext = SecurityActions.currentAccessAuditContext();
Caller caller = getCaller();
auditLogger.log(
isReadOnly(),
resultAction,
caller == null ? null : caller.getName(),
accessContext == null ? null : accessContext.getDomainUuid(),
accessContext == null ? null : accessContext.getAccessMechanism(),
accessContext == null ? null : accessContext.getRemoteAddress(),
getModel(),
controllerOperations);
auditLogged = true;
} catch (Exception e) {
ControllerLogger.MGMT_OP_LOGGER.failedToUpdateAuditLog(e);
}
}
} | [
"void",
"logAuditRecord",
"(",
")",
"{",
"trackConfigurationChange",
"(",
")",
";",
"if",
"(",
"!",
"auditLogged",
")",
"{",
"try",
"{",
"AccessAuditContext",
"accessContext",
"=",
"SecurityActions",
".",
"currentAccessAuditContext",
"(",
")",
";",
"Caller",
"ca... | Log an audit record of this operation. | [
"Log",
"an",
"audit",
"record",
"of",
"this",
"operation",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java#L621-L641 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java | AbstractOperationContext.processStages | private void processStages() {
// Locate the next step to execute.
ModelNode primaryResponse = null;
Step step;
do {
step = steps.get(currentStage).pollFirst();
if (step == null) {
if (currentStage == Stage.MODEL && addModelValidationSteps()) {
continue;
}
// No steps remain in this stage; give subclasses a chance to check status
// and approve moving to the next stage
if (!tryStageCompleted(currentStage)) {
// Can't continue
resultAction = ResultAction.ROLLBACK;
executeResultHandlerPhase(null);
return;
}
// Proceed to the next stage
if (currentStage.hasNext()) {
currentStage = currentStage.next();
if (currentStage == Stage.VERIFY) {
// a change was made to the runtime. Thus, we must wait
// for stability before resuming in to verify.
try {
awaitServiceContainerStability();
} catch (InterruptedException e) {
cancelled = true;
handleContainerStabilityFailure(primaryResponse, e);
executeResultHandlerPhase(null);
return;
} catch (TimeoutException te) {
// The service container is in an unknown state; but we don't require restart
// because rollback may allow the container to stabilize. We force require-restart
// in the rollback handling if the container cannot stabilize (see OperationContextImpl.releaseStepLocks)
//processState.setRestartRequired(); // don't use our restartRequired() method as this is not reversible in rollback
handleContainerStabilityFailure(primaryResponse, te);
executeResultHandlerPhase(null);
return;
}
}
}
} else {
// The response to the first step is what goes to the outside caller
if (primaryResponse == null) {
primaryResponse = step.response;
}
// Execute the step, but make sure we always finalize any steps
Throwable toThrow = null;
// Whether to return after try/finally
boolean exit = false;
try {
CapabilityRegistry.RuntimeStatus stepStatus = getStepExecutionStatus(step);
if (stepStatus == RuntimeCapabilityRegistry.RuntimeStatus.NORMAL) {
executeStep(step);
} else {
String header = stepStatus == RuntimeCapabilityRegistry.RuntimeStatus.RESTART_REQUIRED
? OPERATION_REQUIRES_RESTART : OPERATION_REQUIRES_RELOAD;
step.response.get(RESPONSE_HEADERS, header).set(true);
}
} catch (RuntimeException | Error re) {
resultAction = ResultAction.ROLLBACK;
toThrow = re;
} finally {
// See if executeStep put us in a state where we shouldn't do any more
if (toThrow != null || !canContinueProcessing()) {
// We're done.
executeResultHandlerPhase(toThrow);
exit = true; // we're on the return path
}
}
if (exit) {
return;
}
}
} while (currentStage != Stage.DONE);
assert primaryResponse != null; // else ModelControllerImpl executed an op with no steps
// All steps ran and canContinueProcessing returned true for the last one, so...
executeDoneStage(primaryResponse);
} | java | private void processStages() {
// Locate the next step to execute.
ModelNode primaryResponse = null;
Step step;
do {
step = steps.get(currentStage).pollFirst();
if (step == null) {
if (currentStage == Stage.MODEL && addModelValidationSteps()) {
continue;
}
// No steps remain in this stage; give subclasses a chance to check status
// and approve moving to the next stage
if (!tryStageCompleted(currentStage)) {
// Can't continue
resultAction = ResultAction.ROLLBACK;
executeResultHandlerPhase(null);
return;
}
// Proceed to the next stage
if (currentStage.hasNext()) {
currentStage = currentStage.next();
if (currentStage == Stage.VERIFY) {
// a change was made to the runtime. Thus, we must wait
// for stability before resuming in to verify.
try {
awaitServiceContainerStability();
} catch (InterruptedException e) {
cancelled = true;
handleContainerStabilityFailure(primaryResponse, e);
executeResultHandlerPhase(null);
return;
} catch (TimeoutException te) {
// The service container is in an unknown state; but we don't require restart
// because rollback may allow the container to stabilize. We force require-restart
// in the rollback handling if the container cannot stabilize (see OperationContextImpl.releaseStepLocks)
//processState.setRestartRequired(); // don't use our restartRequired() method as this is not reversible in rollback
handleContainerStabilityFailure(primaryResponse, te);
executeResultHandlerPhase(null);
return;
}
}
}
} else {
// The response to the first step is what goes to the outside caller
if (primaryResponse == null) {
primaryResponse = step.response;
}
// Execute the step, but make sure we always finalize any steps
Throwable toThrow = null;
// Whether to return after try/finally
boolean exit = false;
try {
CapabilityRegistry.RuntimeStatus stepStatus = getStepExecutionStatus(step);
if (stepStatus == RuntimeCapabilityRegistry.RuntimeStatus.NORMAL) {
executeStep(step);
} else {
String header = stepStatus == RuntimeCapabilityRegistry.RuntimeStatus.RESTART_REQUIRED
? OPERATION_REQUIRES_RESTART : OPERATION_REQUIRES_RELOAD;
step.response.get(RESPONSE_HEADERS, header).set(true);
}
} catch (RuntimeException | Error re) {
resultAction = ResultAction.ROLLBACK;
toThrow = re;
} finally {
// See if executeStep put us in a state where we shouldn't do any more
if (toThrow != null || !canContinueProcessing()) {
// We're done.
executeResultHandlerPhase(toThrow);
exit = true; // we're on the return path
}
}
if (exit) {
return;
}
}
} while (currentStage != Stage.DONE);
assert primaryResponse != null; // else ModelControllerImpl executed an op with no steps
// All steps ran and canContinueProcessing returned true for the last one, so...
executeDoneStage(primaryResponse);
} | [
"private",
"void",
"processStages",
"(",
")",
"{",
"// Locate the next step to execute.",
"ModelNode",
"primaryResponse",
"=",
"null",
";",
"Step",
"step",
";",
"do",
"{",
"step",
"=",
"steps",
".",
"get",
"(",
"currentStage",
")",
".",
"pollFirst",
"(",
")",
... | Perform the work of processing the various OperationContext.Stage queues, and then the DONE stage. | [
"Perform",
"the",
"work",
"of",
"processing",
"the",
"various",
"OperationContext",
".",
"Stage",
"queues",
"and",
"then",
"the",
"DONE",
"stage",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java#L687-L770 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java | AbstractOperationContext.checkUndefinedNotification | private void checkUndefinedNotification(Notification notification) {
String type = notification.getType();
PathAddress source = notification.getSource();
Map<String, NotificationEntry> descriptions = getRootResourceRegistration().getNotificationDescriptions(source, true);
if (!descriptions.keySet().contains(type)) {
missingNotificationDescriptionWarnings.add(ControllerLogger.ROOT_LOGGER.notificationIsNotDescribed(type, source));
}
} | java | private void checkUndefinedNotification(Notification notification) {
String type = notification.getType();
PathAddress source = notification.getSource();
Map<String, NotificationEntry> descriptions = getRootResourceRegistration().getNotificationDescriptions(source, true);
if (!descriptions.keySet().contains(type)) {
missingNotificationDescriptionWarnings.add(ControllerLogger.ROOT_LOGGER.notificationIsNotDescribed(type, source));
}
} | [
"private",
"void",
"checkUndefinedNotification",
"(",
"Notification",
"notification",
")",
"{",
"String",
"type",
"=",
"notification",
".",
"getType",
"(",
")",
";",
"PathAddress",
"source",
"=",
"notification",
".",
"getSource",
"(",
")",
";",
"Map",
"<",
"St... | Check that each emitted notification is properly described by its source. | [
"Check",
"that",
"each",
"emitted",
"notification",
"is",
"properly",
"described",
"by",
"its",
"source",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java#L939-L946 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java | AbstractOperationContext.getFailedResultAction | private ResultAction getFailedResultAction(Throwable cause) {
if (currentStage == Stage.MODEL || cancelled || isRollbackOnRuntimeFailure() || isRollbackOnly()
|| (cause != null && !(cause instanceof OperationFailedException))) {
return ResultAction.ROLLBACK;
}
return ResultAction.KEEP;
} | java | private ResultAction getFailedResultAction(Throwable cause) {
if (currentStage == Stage.MODEL || cancelled || isRollbackOnRuntimeFailure() || isRollbackOnly()
|| (cause != null && !(cause instanceof OperationFailedException))) {
return ResultAction.ROLLBACK;
}
return ResultAction.KEEP;
} | [
"private",
"ResultAction",
"getFailedResultAction",
"(",
"Throwable",
"cause",
")",
"{",
"if",
"(",
"currentStage",
"==",
"Stage",
".",
"MODEL",
"||",
"cancelled",
"||",
"isRollbackOnRuntimeFailure",
"(",
")",
"||",
"isRollbackOnly",
"(",
")",
"||",
"(",
"cause"... | Decide whether failure should trigger a rollback.
@param cause
the cause of the failure, or {@code null} if failure is not
the result of catching a throwable
@return the result action | [
"Decide",
"whether",
"failure",
"should",
"trigger",
"a",
"rollback",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractOperationContext.java#L1117-L1123 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java | ServerUpdatePolicy.canUpdateServer | public boolean canUpdateServer(ServerIdentity server) {
if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server);
}
if (!parent.canChildProceed())
return false;
synchronized (this) {
return failureCount <= maxFailed;
}
} | java | public boolean canUpdateServer(ServerIdentity server) {
if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server);
}
if (!parent.canChildProceed())
return false;
synchronized (this) {
return failureCount <= maxFailed;
}
} | [
"public",
"boolean",
"canUpdateServer",
"(",
"ServerIdentity",
"server",
")",
"{",
"if",
"(",
"!",
"serverGroupName",
".",
"equals",
"(",
"server",
".",
"getServerGroupName",
"(",
")",
")",
"||",
"!",
"servers",
".",
"contains",
"(",
"server",
")",
")",
"{... | Gets whether the given server can be updated.
@param server the id of the server. Cannot be <code>null</code>
@return <code>true</code> if the server can be updated; <code>false</code>
if the update should be cancelled
@throws IllegalStateException if this policy is not expecting a request
to update the given server | [
"Gets",
"whether",
"the",
"given",
"server",
"can",
"be",
"updated",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java#L111-L122 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java | ServerUpdatePolicy.recordServerResult | public void recordServerResult(ServerIdentity server, ModelNode response) {
if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server);
}
boolean serverFailed = response.has(FAILURE_DESCRIPTION);
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recording server result for '%s': failed = %s",
server, server);
synchronized (this) {
int previousFailed = failureCount;
if (serverFailed) {
failureCount++;
}
else {
successCount++;
}
if (previousFailed <= maxFailed) {
if (!serverFailed && (successCount + failureCount) == servers.size()) {
// All results are in; notify parent of success
parent.recordServerGroupResult(serverGroupName, false);
}
else if (serverFailed && failureCount > maxFailed) {
parent.recordServerGroupResult(serverGroupName, true);
}
}
}
} | java | public void recordServerResult(ServerIdentity server, ModelNode response) {
if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server);
}
boolean serverFailed = response.has(FAILURE_DESCRIPTION);
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recording server result for '%s': failed = %s",
server, server);
synchronized (this) {
int previousFailed = failureCount;
if (serverFailed) {
failureCount++;
}
else {
successCount++;
}
if (previousFailed <= maxFailed) {
if (!serverFailed && (successCount + failureCount) == servers.size()) {
// All results are in; notify parent of success
parent.recordServerGroupResult(serverGroupName, false);
}
else if (serverFailed && failureCount > maxFailed) {
parent.recordServerGroupResult(serverGroupName, true);
}
}
}
} | [
"public",
"void",
"recordServerResult",
"(",
"ServerIdentity",
"server",
",",
"ModelNode",
"response",
")",
"{",
"if",
"(",
"!",
"serverGroupName",
".",
"equals",
"(",
"server",
".",
"getServerGroupName",
"(",
")",
")",
"||",
"!",
"servers",
".",
"contains",
... | Records the result of updating a server.
@param server the id of the server. Cannot be <code>null</code>
@param response the result of the updates | [
"Records",
"the",
"result",
"of",
"updating",
"a",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java#L130-L160 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/Arguments.java | Arguments.set | public void set(final Argument argument) {
if (argument != null) {
map.put(argument.getKey(), Collections.singleton(argument));
}
} | java | public void set(final Argument argument) {
if (argument != null) {
map.put(argument.getKey(), Collections.singleton(argument));
}
} | [
"public",
"void",
"set",
"(",
"final",
"Argument",
"argument",
")",
"{",
"if",
"(",
"argument",
"!=",
"null",
")",
"{",
"map",
".",
"put",
"(",
"argument",
".",
"getKey",
"(",
")",
",",
"Collections",
".",
"singleton",
"(",
"argument",
")",
")",
";",... | Sets an argument to the collection of arguments. This guarantees only one value will be assigned to the
argument key.
@param argument the argument to add | [
"Sets",
"an",
"argument",
"to",
"the",
"collection",
"of",
"arguments",
".",
"This",
"guarantees",
"only",
"one",
"value",
"will",
"be",
"assigned",
"to",
"the",
"argument",
"key",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Arguments.java#L126-L130 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/Arguments.java | Arguments.get | public String get(final String key) {
final Collection<Argument> args = map.get(key);
if (args != null) {
return args.iterator().hasNext() ? args.iterator().next().getValue() : null;
}
return null;
} | java | public String get(final String key) {
final Collection<Argument> args = map.get(key);
if (args != null) {
return args.iterator().hasNext() ? args.iterator().next().getValue() : null;
}
return null;
} | [
"public",
"String",
"get",
"(",
"final",
"String",
"key",
")",
"{",
"final",
"Collection",
"<",
"Argument",
">",
"args",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"args",
"!=",
"null",
")",
"{",
"return",
"args",
".",
"iterator",
"("... | Gets the first value for the key.
@param key the key to check for the value
@return the value or {@code null} if the key is not found or the value was {@code null} | [
"Gets",
"the",
"first",
"value",
"for",
"the",
"key",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Arguments.java#L154-L160 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/Arguments.java | Arguments.getArguments | public Collection<Argument> getArguments(final String key) {
final Collection<Argument> args = map.get(key);
if (args != null) {
return new ArrayList<>(args);
}
return Collections.emptyList();
} | java | public Collection<Argument> getArguments(final String key) {
final Collection<Argument> args = map.get(key);
if (args != null) {
return new ArrayList<>(args);
}
return Collections.emptyList();
} | [
"public",
"Collection",
"<",
"Argument",
">",
"getArguments",
"(",
"final",
"String",
"key",
")",
"{",
"final",
"Collection",
"<",
"Argument",
">",
"args",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"args",
"!=",
"null",
")",
"{",
"retu... | Gets the value for the key.
@param key the key to check for the value
@return the value or an empty collection if no values were set | [
"Gets",
"the",
"value",
"for",
"the",
"key",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Arguments.java#L169-L175 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/Arguments.java | Arguments.asList | public List<String> asList() {
final List<String> result = new ArrayList<>();
for (Collection<Argument> args : map.values()) {
for (Argument arg : args) {
result.add(arg.asCommandLineArgument());
}
}
return result;
} | java | public List<String> asList() {
final List<String> result = new ArrayList<>();
for (Collection<Argument> args : map.values()) {
for (Argument arg : args) {
result.add(arg.asCommandLineArgument());
}
}
return result;
} | [
"public",
"List",
"<",
"String",
">",
"asList",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Collection",
"<",
"Argument",
">",
"args",
":",
"map",
".",
"values",
"(",
")",... | Returns the arguments as a list in their command line form.
@return the arguments for the command line | [
"Returns",
"the",
"arguments",
"as",
"a",
"list",
"in",
"their",
"command",
"line",
"form",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Arguments.java#L193-L201 | train |
wildfly/wildfly-core | domain-management/src/main/java/org/jboss/as/domain/management/parsing/ManagementXml_Legacy.java | ManagementXml_Legacy.parseLdapAuthorization_1_5 | private void parseLdapAuthorization_1_5(final XMLExtendedStreamReader reader,
final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException {
ModelNode addr = realmAddress.clone().add(AUTHORIZATION, LDAP);
ModelNode ldapAuthorization = Util.getEmptyOperation(ADD, addr);
list.add(ldapAuthorization);
Set<Attribute> required = EnumSet.of(Attribute.CONNECTION);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch (attribute) {
case CONNECTION: {
LdapAuthorizationResourceDefinition.CONNECTION.parseAndSetParameter(value, ldapAuthorization, reader);
break;
}
default: {
throw unexpectedAttribute(reader, i);
}
}
}
}
if (required.isEmpty() == false) {
throw missingRequired(reader, required);
}
Set<Element> foundElements = new HashSet<Element>();
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader, namespace);
final Element element = Element.forName(reader.getLocalName());
if (foundElements.add(element) == false) {
throw unexpectedElement(reader); // Only one of each allowed.
}
switch (element) {
case USERNAME_TO_DN: {
switch (namespace.getMajorVersion()) {
case 1: // 1.5 up to but not including 2.0
parseUsernameToDn_1_5(reader, addr, list);
break;
default: // 2.0 and onwards
parseUsernameToDn_2_0(reader, addr, list);
break;
}
break;
}
case GROUP_SEARCH: {
switch (namespace) {
case DOMAIN_1_5:
case DOMAIN_1_6:
parseGroupSearch_1_5(reader, addr, list);
break;
default:
parseGroupSearch_1_7_and_2_0(reader, addr, list);
break;
}
break;
}
default: {
throw unexpectedElement(reader);
}
}
}
} | java | private void parseLdapAuthorization_1_5(final XMLExtendedStreamReader reader,
final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException {
ModelNode addr = realmAddress.clone().add(AUTHORIZATION, LDAP);
ModelNode ldapAuthorization = Util.getEmptyOperation(ADD, addr);
list.add(ldapAuthorization);
Set<Attribute> required = EnumSet.of(Attribute.CONNECTION);
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
required.remove(attribute);
switch (attribute) {
case CONNECTION: {
LdapAuthorizationResourceDefinition.CONNECTION.parseAndSetParameter(value, ldapAuthorization, reader);
break;
}
default: {
throw unexpectedAttribute(reader, i);
}
}
}
}
if (required.isEmpty() == false) {
throw missingRequired(reader, required);
}
Set<Element> foundElements = new HashSet<Element>();
while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
requireNamespace(reader, namespace);
final Element element = Element.forName(reader.getLocalName());
if (foundElements.add(element) == false) {
throw unexpectedElement(reader); // Only one of each allowed.
}
switch (element) {
case USERNAME_TO_DN: {
switch (namespace.getMajorVersion()) {
case 1: // 1.5 up to but not including 2.0
parseUsernameToDn_1_5(reader, addr, list);
break;
default: // 2.0 and onwards
parseUsernameToDn_2_0(reader, addr, list);
break;
}
break;
}
case GROUP_SEARCH: {
switch (namespace) {
case DOMAIN_1_5:
case DOMAIN_1_6:
parseGroupSearch_1_5(reader, addr, list);
break;
default:
parseGroupSearch_1_7_and_2_0(reader, addr, list);
break;
}
break;
}
default: {
throw unexpectedElement(reader);
}
}
}
} | [
"private",
"void",
"parseLdapAuthorization_1_5",
"(",
"final",
"XMLExtendedStreamReader",
"reader",
",",
"final",
"ModelNode",
"realmAddress",
",",
"final",
"List",
"<",
"ModelNode",
">",
"list",
")",
"throws",
"XMLStreamException",
"{",
"ModelNode",
"addr",
"=",
"r... | 1.5 and on, 2.0 and on, 3.0 and on. | [
"1",
".",
"5",
"and",
"on",
"2",
".",
"0",
"and",
"on",
"3",
".",
"0",
"and",
"on",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/parsing/ManagementXml_Legacy.java#L2443-L2512 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/module/ResourceRoot.java | ResourceRoot.merge | public void merge(final ResourceRoot additionalResourceRoot) {
if(!additionalResourceRoot.getRoot().equals(root)) {
throw ServerLogger.ROOT_LOGGER.cannotMergeResourceRoot(root, additionalResourceRoot.getRoot());
}
usePhysicalCodeSource = additionalResourceRoot.usePhysicalCodeSource;
if(additionalResourceRoot.getExportFilters().isEmpty()) {
//new root has no filters, so we don't want our existing filters to break anything
//see WFLY-1527
this.exportFilters.clear();
} else {
this.exportFilters.addAll(additionalResourceRoot.getExportFilters());
}
} | java | public void merge(final ResourceRoot additionalResourceRoot) {
if(!additionalResourceRoot.getRoot().equals(root)) {
throw ServerLogger.ROOT_LOGGER.cannotMergeResourceRoot(root, additionalResourceRoot.getRoot());
}
usePhysicalCodeSource = additionalResourceRoot.usePhysicalCodeSource;
if(additionalResourceRoot.getExportFilters().isEmpty()) {
//new root has no filters, so we don't want our existing filters to break anything
//see WFLY-1527
this.exportFilters.clear();
} else {
this.exportFilters.addAll(additionalResourceRoot.getExportFilters());
}
} | [
"public",
"void",
"merge",
"(",
"final",
"ResourceRoot",
"additionalResourceRoot",
")",
"{",
"if",
"(",
"!",
"additionalResourceRoot",
".",
"getRoot",
"(",
")",
".",
"equals",
"(",
"root",
")",
")",
"{",
"throw",
"ServerLogger",
".",
"ROOT_LOGGER",
".",
"can... | Merges information from the resource root into this resource root
@param additionalResourceRoot The root to merge | [
"Merges",
"information",
"from",
"the",
"resource",
"root",
"into",
"this",
"resource",
"root"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/module/ResourceRoot.java#L94-L106 | train |
wildfly/wildfly-core | security-manager/src/main/java/org/wildfly/extension/security/manager/SecurityManagerExtensionTransformerRegistration.java | SecurityManagerExtensionTransformerRegistration.registerTransformers | @Override
public void registerTransformers(SubsystemTransformerRegistration subsystemRegistration) {
ResourceTransformationDescriptionBuilder builder = ResourceTransformationDescriptionBuilder.Factory.createSubsystemInstance();
builder.addChildResource(DeploymentPermissionsResourceDefinition.DEPLOYMENT_PERMISSIONS_PATH).
getAttributeBuilder().addRejectCheck(new RejectAttributeChecker.DefaultRejectAttributeChecker() {
@Override
protected boolean rejectAttribute(PathAddress address, String attributeName, ModelNode value, TransformationContext context) {
// reject the maximum set if it is defined and empty as that would result in complete incompatible policies
// being used in nodes running earlier versions of the subsystem.
if (value.isDefined() && value.asList().isEmpty()) { return true; }
return false;
}
@Override
public String getRejectionLogMessage(Map<String, ModelNode> attributes) {
return SecurityManagerLogger.ROOT_LOGGER.rejectedEmptyMaximumSet();
}
}, DeploymentPermissionsResourceDefinition.MAXIMUM_PERMISSIONS);
TransformationDescription.Tools.register(builder.build(), subsystemRegistration, EAP_7_0_0_MODEL_VERSION);
} | java | @Override
public void registerTransformers(SubsystemTransformerRegistration subsystemRegistration) {
ResourceTransformationDescriptionBuilder builder = ResourceTransformationDescriptionBuilder.Factory.createSubsystemInstance();
builder.addChildResource(DeploymentPermissionsResourceDefinition.DEPLOYMENT_PERMISSIONS_PATH).
getAttributeBuilder().addRejectCheck(new RejectAttributeChecker.DefaultRejectAttributeChecker() {
@Override
protected boolean rejectAttribute(PathAddress address, String attributeName, ModelNode value, TransformationContext context) {
// reject the maximum set if it is defined and empty as that would result in complete incompatible policies
// being used in nodes running earlier versions of the subsystem.
if (value.isDefined() && value.asList().isEmpty()) { return true; }
return false;
}
@Override
public String getRejectionLogMessage(Map<String, ModelNode> attributes) {
return SecurityManagerLogger.ROOT_LOGGER.rejectedEmptyMaximumSet();
}
}, DeploymentPermissionsResourceDefinition.MAXIMUM_PERMISSIONS);
TransformationDescription.Tools.register(builder.build(), subsystemRegistration, EAP_7_0_0_MODEL_VERSION);
} | [
"@",
"Override",
"public",
"void",
"registerTransformers",
"(",
"SubsystemTransformerRegistration",
"subsystemRegistration",
")",
"{",
"ResourceTransformationDescriptionBuilder",
"builder",
"=",
"ResourceTransformationDescriptionBuilder",
".",
"Factory",
".",
"createSubsystemInstan... | Registers the transformers for JBoss EAP 7.0.0.
@param subsystemRegistration contains data about the subsystem registration | [
"Registers",
"the",
"transformers",
"for",
"JBoss",
"EAP",
"7",
".",
"0",
".",
"0",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/security-manager/src/main/java/org/wildfly/extension/security/manager/SecurityManagerExtensionTransformerRegistration.java#L50-L70 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/operations/global/FilteredData.java | FilteredData.toModelNode | ModelNode toModelNode() {
ModelNode result = null;
if (map != null) {
result = new ModelNode();
for (Map.Entry<PathAddress, ResourceData> entry : map.entrySet()) {
ModelNode item = new ModelNode();
PathAddress pa = entry.getKey();
item.get(ABSOLUTE_ADDRESS).set(pa.toModelNode());
ResourceData rd = entry.getValue();
item.get(RELATIVE_ADDRESS).set(pa.subAddress(baseAddressLength).toModelNode());
ModelNode attrs = new ModelNode().setEmptyList();
if (rd.attributes != null) {
for (String attr : rd.attributes) {
attrs.add(attr);
}
}
if (attrs.asInt() > 0) {
item.get(FILTERED_ATTRIBUTES).set(attrs);
}
ModelNode children = new ModelNode().setEmptyList();
if (rd.children != null) {
for (PathElement pe : rd.children) {
children.add(new Property(pe.getKey(), new ModelNode(pe.getValue())));
}
}
if (children.asInt() > 0) {
item.get(UNREADABLE_CHILDREN).set(children);
}
ModelNode childTypes = new ModelNode().setEmptyList();
if (rd.childTypes != null) {
Set<String> added = new HashSet<String>();
for (PathElement pe : rd.childTypes) {
if (added.add(pe.getKey())) {
childTypes.add(pe.getKey());
}
}
}
if (childTypes.asInt() > 0) {
item.get(FILTERED_CHILDREN_TYPES).set(childTypes);
}
result.add(item);
}
}
return result;
} | java | ModelNode toModelNode() {
ModelNode result = null;
if (map != null) {
result = new ModelNode();
for (Map.Entry<PathAddress, ResourceData> entry : map.entrySet()) {
ModelNode item = new ModelNode();
PathAddress pa = entry.getKey();
item.get(ABSOLUTE_ADDRESS).set(pa.toModelNode());
ResourceData rd = entry.getValue();
item.get(RELATIVE_ADDRESS).set(pa.subAddress(baseAddressLength).toModelNode());
ModelNode attrs = new ModelNode().setEmptyList();
if (rd.attributes != null) {
for (String attr : rd.attributes) {
attrs.add(attr);
}
}
if (attrs.asInt() > 0) {
item.get(FILTERED_ATTRIBUTES).set(attrs);
}
ModelNode children = new ModelNode().setEmptyList();
if (rd.children != null) {
for (PathElement pe : rd.children) {
children.add(new Property(pe.getKey(), new ModelNode(pe.getValue())));
}
}
if (children.asInt() > 0) {
item.get(UNREADABLE_CHILDREN).set(children);
}
ModelNode childTypes = new ModelNode().setEmptyList();
if (rd.childTypes != null) {
Set<String> added = new HashSet<String>();
for (PathElement pe : rd.childTypes) {
if (added.add(pe.getKey())) {
childTypes.add(pe.getKey());
}
}
}
if (childTypes.asInt() > 0) {
item.get(FILTERED_CHILDREN_TYPES).set(childTypes);
}
result.add(item);
}
}
return result;
} | [
"ModelNode",
"toModelNode",
"(",
")",
"{",
"ModelNode",
"result",
"=",
"null",
";",
"if",
"(",
"map",
"!=",
"null",
")",
"{",
"result",
"=",
"new",
"ModelNode",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"PathAddress",
",",
"ResourceData",
... | Report on the filtered data in DMR . | [
"Report",
"on",
"the",
"filtered",
"data",
"in",
"DMR",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/global/FilteredData.java#L107-L151 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.rollbackLast | public PatchingResult rollbackLast(final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration, InstallationManager.InstallationModification modification) throws PatchingException {
// Determine the patch id to rollback
String patchId;
final List<String> oneOffs = modification.getPatchIDs();
if (oneOffs.isEmpty()) {
patchId = modification.getCumulativePatchID();
if (patchId == null || Constants.NOT_PATCHED.equals(patchId)) {
throw PatchLogger.ROOT_LOGGER.noPatchesApplied();
}
} else {
patchId = oneOffs.get(0);//oneOffs.get(oneOffs.size() - 1);
}
return rollbackPatch(patchId, contentPolicy, false, resetConfiguration, modification);
} | java | public PatchingResult rollbackLast(final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration, InstallationManager.InstallationModification modification) throws PatchingException {
// Determine the patch id to rollback
String patchId;
final List<String> oneOffs = modification.getPatchIDs();
if (oneOffs.isEmpty()) {
patchId = modification.getCumulativePatchID();
if (patchId == null || Constants.NOT_PATCHED.equals(patchId)) {
throw PatchLogger.ROOT_LOGGER.noPatchesApplied();
}
} else {
patchId = oneOffs.get(0);//oneOffs.get(oneOffs.size() - 1);
}
return rollbackPatch(patchId, contentPolicy, false, resetConfiguration, modification);
} | [
"public",
"PatchingResult",
"rollbackLast",
"(",
"final",
"ContentVerificationPolicy",
"contentPolicy",
",",
"final",
"boolean",
"resetConfiguration",
",",
"InstallationManager",
".",
"InstallationModification",
"modification",
")",
"throws",
"PatchingException",
"{",
"// Det... | Rollback the last applied patch.
@param contentPolicy the content policy
@param resetConfiguration whether to reset the configuration
@param modification the installation modification
@return the patching result
@throws PatchingException | [
"Rollback",
"the",
"last",
"applied",
"patch",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L284-L298 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.restoreFromHistory | static void restoreFromHistory(final InstallationManager.MutablePatchingTarget target, final String rollbackPatchId,
final Patch.PatchType patchType, final PatchableTarget.TargetInfo history) throws PatchingException {
if (patchType == Patch.PatchType.CUMULATIVE) {
assert history.getCumulativePatchID().equals(rollbackPatchId);
target.apply(rollbackPatchId, patchType);
// Restore one off state
final List<String> oneOffs = new ArrayList<String>(history.getPatchIDs());
Collections.reverse(oneOffs);
for (final String oneOff : oneOffs) {
target.apply(oneOff, Patch.PatchType.ONE_OFF);
}
}
checkState(history, history); // Just check for tests, that rollback should restore the old state
} | java | static void restoreFromHistory(final InstallationManager.MutablePatchingTarget target, final String rollbackPatchId,
final Patch.PatchType patchType, final PatchableTarget.TargetInfo history) throws PatchingException {
if (patchType == Patch.PatchType.CUMULATIVE) {
assert history.getCumulativePatchID().equals(rollbackPatchId);
target.apply(rollbackPatchId, patchType);
// Restore one off state
final List<String> oneOffs = new ArrayList<String>(history.getPatchIDs());
Collections.reverse(oneOffs);
for (final String oneOff : oneOffs) {
target.apply(oneOff, Patch.PatchType.ONE_OFF);
}
}
checkState(history, history); // Just check for tests, that rollback should restore the old state
} | [
"static",
"void",
"restoreFromHistory",
"(",
"final",
"InstallationManager",
".",
"MutablePatchingTarget",
"target",
",",
"final",
"String",
"rollbackPatchId",
",",
"final",
"Patch",
".",
"PatchType",
"patchType",
",",
"final",
"PatchableTarget",
".",
"TargetInfo",
"h... | Restore the recorded state from the rollback xml.
@param target the patchable target
@param rollbackPatchId the rollback patch id
@param patchType the the current patch type
@param history the recorded history
@throws PatchingException | [
"Restore",
"the",
"recorded",
"state",
"from",
"the",
"rollback",
"xml",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L425-L438 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.portForward | void portForward(final Patch patch, IdentityPatchContext context) throws PatchingException, IOException, XMLStreamException {
assert patch.getIdentity().getPatchType() == Patch.PatchType.CUMULATIVE;
final PatchingHistory history = context.getHistory();
for (final PatchElement element : patch.getElements()) {
final PatchElementProvider provider = element.getProvider();
final String name = provider.getName();
final boolean addOn = provider.isAddOn();
final IdentityPatchContext.PatchEntry target = context.resolveForElement(element);
final String cumulativePatchID = target.getCumulativePatchID();
if (Constants.BASE.equals(cumulativePatchID)) {
reenableRolledBackInBase(target);
continue;
}
boolean found = false;
final PatchingHistory.Iterator iterator = history.iterator();
while (iterator.hasNextCP()) {
final PatchingHistory.Entry entry = iterator.nextCP();
final String patchId = addOn ? entry.getAddOnPatches().get(name) : entry.getLayerPatches().get(name);
if (patchId != null && patchId.equals(cumulativePatchID)) {
final Patch original = loadPatchInformation(entry.getPatchId(), installedImage);
for (final PatchElement originalElement : original.getElements()) {
if (name.equals(originalElement.getProvider().getName())
&& addOn == originalElement.getProvider().isAddOn()) {
PatchingTasks.addMissingModifications(target, originalElement.getModifications(), ContentItemFilter.ALL_BUT_MISC);
}
}
// Record a loader to have access to the current modules
final DirectoryStructure structure = target.getDirectoryStructure();
final File modulesRoot = structure.getModulePatchDirectory(patchId);
final File bundlesRoot = structure.getBundlesPatchDirectory(patchId);
final PatchContentLoader loader = PatchContentLoader.create(null, bundlesRoot, modulesRoot);
context.recordContentLoader(patchId, loader);
found = true;
break;
}
}
if (!found) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(cumulativePatchID);
}
reenableRolledBackInBase(target);
}
} | java | void portForward(final Patch patch, IdentityPatchContext context) throws PatchingException, IOException, XMLStreamException {
assert patch.getIdentity().getPatchType() == Patch.PatchType.CUMULATIVE;
final PatchingHistory history = context.getHistory();
for (final PatchElement element : patch.getElements()) {
final PatchElementProvider provider = element.getProvider();
final String name = provider.getName();
final boolean addOn = provider.isAddOn();
final IdentityPatchContext.PatchEntry target = context.resolveForElement(element);
final String cumulativePatchID = target.getCumulativePatchID();
if (Constants.BASE.equals(cumulativePatchID)) {
reenableRolledBackInBase(target);
continue;
}
boolean found = false;
final PatchingHistory.Iterator iterator = history.iterator();
while (iterator.hasNextCP()) {
final PatchingHistory.Entry entry = iterator.nextCP();
final String patchId = addOn ? entry.getAddOnPatches().get(name) : entry.getLayerPatches().get(name);
if (patchId != null && patchId.equals(cumulativePatchID)) {
final Patch original = loadPatchInformation(entry.getPatchId(), installedImage);
for (final PatchElement originalElement : original.getElements()) {
if (name.equals(originalElement.getProvider().getName())
&& addOn == originalElement.getProvider().isAddOn()) {
PatchingTasks.addMissingModifications(target, originalElement.getModifications(), ContentItemFilter.ALL_BUT_MISC);
}
}
// Record a loader to have access to the current modules
final DirectoryStructure structure = target.getDirectoryStructure();
final File modulesRoot = structure.getModulePatchDirectory(patchId);
final File bundlesRoot = structure.getBundlesPatchDirectory(patchId);
final PatchContentLoader loader = PatchContentLoader.create(null, bundlesRoot, modulesRoot);
context.recordContentLoader(patchId, loader);
found = true;
break;
}
}
if (!found) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(cumulativePatchID);
}
reenableRolledBackInBase(target);
}
} | [
"void",
"portForward",
"(",
"final",
"Patch",
"patch",
",",
"IdentityPatchContext",
"context",
")",
"throws",
"PatchingException",
",",
"IOException",
",",
"XMLStreamException",
"{",
"assert",
"patch",
".",
"getIdentity",
"(",
")",
".",
"getPatchType",
"(",
")",
... | Port forward missing module changes for each layer.
@param patch the current patch
@param context the patch context
@throws PatchingException
@throws IOException
@throws XMLStreamException | [
"Port",
"forward",
"missing",
"module",
"changes",
"for",
"each",
"layer",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L563-L610 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.executeTasks | static PatchingResult executeTasks(final IdentityPatchContext context, final IdentityPatchContext.FinalizeCallback callback) throws Exception {
final List<PreparedTask> tasks = new ArrayList<PreparedTask>();
final List<ContentItem> conflicts = new ArrayList<ContentItem>();
// Identity
prepareTasks(context.getIdentityEntry(), context, tasks, conflicts);
// Layers
for (final IdentityPatchContext.PatchEntry layer : context.getLayers()) {
prepareTasks(layer, context, tasks, conflicts);
}
// AddOns
for (final IdentityPatchContext.PatchEntry addOn : context.getAddOns()) {
prepareTasks(addOn, context, tasks, conflicts);
}
// If there were problems report them
if (!conflicts.isEmpty()) {
throw PatchLogger.ROOT_LOGGER.conflictsDetected(conflicts);
}
// Execute the tasks
for (final PreparedTask task : tasks) {
// Unless it's excluded by the user
final ContentItem item = task.getContentItem();
if (item != null && context.isExcluded(item)) {
continue;
}
// Run the task
task.execute();
}
return context.finalize(callback);
} | java | static PatchingResult executeTasks(final IdentityPatchContext context, final IdentityPatchContext.FinalizeCallback callback) throws Exception {
final List<PreparedTask> tasks = new ArrayList<PreparedTask>();
final List<ContentItem> conflicts = new ArrayList<ContentItem>();
// Identity
prepareTasks(context.getIdentityEntry(), context, tasks, conflicts);
// Layers
for (final IdentityPatchContext.PatchEntry layer : context.getLayers()) {
prepareTasks(layer, context, tasks, conflicts);
}
// AddOns
for (final IdentityPatchContext.PatchEntry addOn : context.getAddOns()) {
prepareTasks(addOn, context, tasks, conflicts);
}
// If there were problems report them
if (!conflicts.isEmpty()) {
throw PatchLogger.ROOT_LOGGER.conflictsDetected(conflicts);
}
// Execute the tasks
for (final PreparedTask task : tasks) {
// Unless it's excluded by the user
final ContentItem item = task.getContentItem();
if (item != null && context.isExcluded(item)) {
continue;
}
// Run the task
task.execute();
}
return context.finalize(callback);
} | [
"static",
"PatchingResult",
"executeTasks",
"(",
"final",
"IdentityPatchContext",
"context",
",",
"final",
"IdentityPatchContext",
".",
"FinalizeCallback",
"callback",
")",
"throws",
"Exception",
"{",
"final",
"List",
"<",
"PreparedTask",
">",
"tasks",
"=",
"new",
"... | Execute all recorded tasks.
@param context the patch context
@param callback the finalization callback
@throws Exception | [
"Execute",
"all",
"recorded",
"tasks",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L630-L658 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.prepareTasks | static void prepareTasks(final IdentityPatchContext.PatchEntry entry, final IdentityPatchContext context, final List<PreparedTask> tasks, final List<ContentItem> conflicts) throws PatchingException {
for (final PatchingTasks.ContentTaskDefinition definition : entry.getTaskDefinitions()) {
final PatchingTask task = createTask(definition, context, entry);
if(!task.isRelevant(entry)) {
continue;
}
try {
// backup and validate content
if (!task.prepare(entry) || definition.hasConflicts()) {
// Unless it a content item was manually ignored (or excluded)
final ContentItem item = task.getContentItem();
if (!context.isIgnored(item)) {
conflicts.add(item);
}
}
tasks.add(new PreparedTask(task, entry));
} catch (IOException e) {
throw new PatchingException(e);
}
}
} | java | static void prepareTasks(final IdentityPatchContext.PatchEntry entry, final IdentityPatchContext context, final List<PreparedTask> tasks, final List<ContentItem> conflicts) throws PatchingException {
for (final PatchingTasks.ContentTaskDefinition definition : entry.getTaskDefinitions()) {
final PatchingTask task = createTask(definition, context, entry);
if(!task.isRelevant(entry)) {
continue;
}
try {
// backup and validate content
if (!task.prepare(entry) || definition.hasConflicts()) {
// Unless it a content item was manually ignored (or excluded)
final ContentItem item = task.getContentItem();
if (!context.isIgnored(item)) {
conflicts.add(item);
}
}
tasks.add(new PreparedTask(task, entry));
} catch (IOException e) {
throw new PatchingException(e);
}
}
} | [
"static",
"void",
"prepareTasks",
"(",
"final",
"IdentityPatchContext",
".",
"PatchEntry",
"entry",
",",
"final",
"IdentityPatchContext",
"context",
",",
"final",
"List",
"<",
"PreparedTask",
">",
"tasks",
",",
"final",
"List",
"<",
"ContentItem",
">",
"conflicts"... | Prepare all tasks.
@param entry the patch entry
@param context the patch context
@param tasks a list for prepared tasks
@param conflicts a list for conflicting content items
@throws PatchingException | [
"Prepare",
"all",
"tasks",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L669-L689 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.createTask | static PatchingTask createTask(final PatchingTasks.ContentTaskDefinition definition, final PatchContentProvider provider, final IdentityPatchContext.PatchEntry context) {
final PatchContentLoader contentLoader = provider.getLoader(definition.getTarget().getPatchId());
final PatchingTaskDescription description = PatchingTaskDescription.create(definition, contentLoader);
return PatchingTask.Factory.create(description, context);
} | java | static PatchingTask createTask(final PatchingTasks.ContentTaskDefinition definition, final PatchContentProvider provider, final IdentityPatchContext.PatchEntry context) {
final PatchContentLoader contentLoader = provider.getLoader(definition.getTarget().getPatchId());
final PatchingTaskDescription description = PatchingTaskDescription.create(definition, contentLoader);
return PatchingTask.Factory.create(description, context);
} | [
"static",
"PatchingTask",
"createTask",
"(",
"final",
"PatchingTasks",
".",
"ContentTaskDefinition",
"definition",
",",
"final",
"PatchContentProvider",
"provider",
",",
"final",
"IdentityPatchContext",
".",
"PatchEntry",
"context",
")",
"{",
"final",
"PatchContentLoader"... | Create the patching task based on the definition.
@param definition the task description
@param provider the content provider
@param context the task context
@return the created task | [
"Create",
"the",
"patching",
"task",
"based",
"on",
"the",
"definition",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L699-L703 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java | IdentityPatchRunner.checkUpgradeConditions | static void checkUpgradeConditions(final UpgradeCondition condition, final InstallationManager.MutablePatchingTarget target) throws PatchingException {
// See if the prerequisites are met
for (final String required : condition.getRequires()) {
if (!target.isApplied(required)) {
throw PatchLogger.ROOT_LOGGER.requiresPatch(required);
}
}
// Check for incompatibilities
for (final String incompatible : condition.getIncompatibleWith()) {
if (target.isApplied(incompatible)) {
throw PatchLogger.ROOT_LOGGER.incompatiblePatch(incompatible);
}
}
} | java | static void checkUpgradeConditions(final UpgradeCondition condition, final InstallationManager.MutablePatchingTarget target) throws PatchingException {
// See if the prerequisites are met
for (final String required : condition.getRequires()) {
if (!target.isApplied(required)) {
throw PatchLogger.ROOT_LOGGER.requiresPatch(required);
}
}
// Check for incompatibilities
for (final String incompatible : condition.getIncompatibleWith()) {
if (target.isApplied(incompatible)) {
throw PatchLogger.ROOT_LOGGER.incompatiblePatch(incompatible);
}
}
} | [
"static",
"void",
"checkUpgradeConditions",
"(",
"final",
"UpgradeCondition",
"condition",
",",
"final",
"InstallationManager",
".",
"MutablePatchingTarget",
"target",
")",
"throws",
"PatchingException",
"{",
"// See if the prerequisites are met",
"for",
"(",
"final",
"Stri... | Check whether the patch can be applied to a given target.
@param condition the conditions
@param target the target
@throws PatchingException | [
"Check",
"whether",
"the",
"patch",
"can",
"be",
"applied",
"to",
"a",
"given",
"target",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L769-L782 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Util.java | S3Util.domainControllerDataFromByteBuffer | public static List<DomainControllerData> domainControllerDataFromByteBuffer(byte[] buffer) throws Exception {
List<DomainControllerData> retval = new ArrayList<DomainControllerData>();
if (buffer == null) {
return retval;
}
ByteArrayInputStream in_stream = new ByteArrayInputStream(buffer);
DataInputStream in = new DataInputStream(in_stream);
String content = SEPARATOR;
while (SEPARATOR.equals(content)) {
DomainControllerData data = new DomainControllerData();
data.readFrom(in);
retval.add(data);
try {
content = readString(in);
} catch (EOFException ex) {
content = null;
}
}
in.close();
return retval;
} | java | public static List<DomainControllerData> domainControllerDataFromByteBuffer(byte[] buffer) throws Exception {
List<DomainControllerData> retval = new ArrayList<DomainControllerData>();
if (buffer == null) {
return retval;
}
ByteArrayInputStream in_stream = new ByteArrayInputStream(buffer);
DataInputStream in = new DataInputStream(in_stream);
String content = SEPARATOR;
while (SEPARATOR.equals(content)) {
DomainControllerData data = new DomainControllerData();
data.readFrom(in);
retval.add(data);
try {
content = readString(in);
} catch (EOFException ex) {
content = null;
}
}
in.close();
return retval;
} | [
"public",
"static",
"List",
"<",
"DomainControllerData",
">",
"domainControllerDataFromByteBuffer",
"(",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"Exception",
"{",
"List",
"<",
"DomainControllerData",
">",
"retval",
"=",
"new",
"ArrayList",
"<",
"DomainControllerD... | Get the domain controller data from the given byte buffer.
@param buffer the byte buffer
@return the domain controller data
@throws Exception | [
"Get",
"the",
"domain",
"controller",
"data",
"from",
"the",
"given",
"byte",
"buffer",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Util.java#L83-L103 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Util.java | S3Util.domainControllerDataToByteBuffer | public static byte[] domainControllerDataToByteBuffer(List<DomainControllerData> data) throws Exception {
final ByteArrayOutputStream out_stream = new ByteArrayOutputStream(512);
byte[] result;
try (DataOutputStream out = new DataOutputStream(out_stream)) {
Iterator<DomainControllerData> iter = data.iterator();
while (iter.hasNext()) {
DomainControllerData dcData = iter.next();
dcData.writeTo(out);
if (iter.hasNext()) {
S3Util.writeString(SEPARATOR, out);
}
}
result = out_stream.toByteArray();
}
return result;
} | java | public static byte[] domainControllerDataToByteBuffer(List<DomainControllerData> data) throws Exception {
final ByteArrayOutputStream out_stream = new ByteArrayOutputStream(512);
byte[] result;
try (DataOutputStream out = new DataOutputStream(out_stream)) {
Iterator<DomainControllerData> iter = data.iterator();
while (iter.hasNext()) {
DomainControllerData dcData = iter.next();
dcData.writeTo(out);
if (iter.hasNext()) {
S3Util.writeString(SEPARATOR, out);
}
}
result = out_stream.toByteArray();
}
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"domainControllerDataToByteBuffer",
"(",
"List",
"<",
"DomainControllerData",
">",
"data",
")",
"throws",
"Exception",
"{",
"final",
"ByteArrayOutputStream",
"out_stream",
"=",
"new",
"ByteArrayOutputStream",
"(",
"512",
")",
";... | Write the domain controller data to a byte buffer.
@param data the domain controller data
@return the byte buffer
@throws Exception | [
"Write",
"the",
"domain",
"controller",
"data",
"to",
"a",
"byte",
"buffer",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Util.java#L112-L127 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ConcurrentGroupServerUpdatePolicy.java | ConcurrentGroupServerUpdatePolicy.canSuccessorProceed | private boolean canSuccessorProceed() {
if (predecessor != null && !predecessor.canSuccessorProceed()) {
return false;
}
synchronized (this) {
while (responseCount < groups.size()) {
try {
wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
}
return !failed;
}
} | java | private boolean canSuccessorProceed() {
if (predecessor != null && !predecessor.canSuccessorProceed()) {
return false;
}
synchronized (this) {
while (responseCount < groups.size()) {
try {
wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
}
return !failed;
}
} | [
"private",
"boolean",
"canSuccessorProceed",
"(",
")",
"{",
"if",
"(",
"predecessor",
"!=",
"null",
"&&",
"!",
"predecessor",
".",
"canSuccessorProceed",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"while",
"(",
... | Check from another ConcurrentGroupServerUpdatePolicy whose plans are meant to
execute once this policy's plans are successfully completed.
@return <code>true</code> if the successor can proceed | [
"Check",
"from",
"another",
"ConcurrentGroupServerUpdatePolicy",
"whose",
"plans",
"are",
"meant",
"to",
"execute",
"once",
"this",
"policy",
"s",
"plans",
"are",
"successfully",
"completed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ConcurrentGroupServerUpdatePolicy.java#L64-L81 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ConcurrentGroupServerUpdatePolicy.java | ConcurrentGroupServerUpdatePolicy.recordServerGroupResult | public void recordServerGroupResult(final String serverGroup, final boolean failed) {
synchronized (this) {
if (groups.contains(serverGroup)) {
responseCount++;
if (failed) {
this.failed = true;
}
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recorded group result for '%s': failed = %s",
serverGroup, failed);
notifyAll();
}
else {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServerGroup(serverGroup);
}
}
} | java | public void recordServerGroupResult(final String serverGroup, final boolean failed) {
synchronized (this) {
if (groups.contains(serverGroup)) {
responseCount++;
if (failed) {
this.failed = true;
}
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recorded group result for '%s': failed = %s",
serverGroup, failed);
notifyAll();
}
else {
throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServerGroup(serverGroup);
}
}
} | [
"public",
"void",
"recordServerGroupResult",
"(",
"final",
"String",
"serverGroup",
",",
"final",
"boolean",
"failed",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"groups",
".",
"contains",
"(",
"serverGroup",
")",
")",
"{",
"responseCount",
... | Records the result of updating a server group.
@param serverGroup the server group's name. Cannot be <code>null</code>
@param failed <code>true</code> if the server group update failed;
<code>false</code> if it succeeded | [
"Records",
"the",
"result",
"of",
"updating",
"a",
"server",
"group",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ConcurrentGroupServerUpdatePolicy.java#L100-L116 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java | ModelControllerImpl.executeReadOnlyOperation | @SuppressWarnings("deprecation")
protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) {
final AbstractOperationContext delegateContext = getDelegateContext(operationId);
CurrentOperationIdHolder.setCurrentOperationID(operationId);
try {
return executeReadOnlyOperation(operation, delegateContext.getManagementModel(), control, prepareStep, delegateContext);
} finally {
CurrentOperationIdHolder.setCurrentOperationID(null);
}
} | java | @SuppressWarnings("deprecation")
protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) {
final AbstractOperationContext delegateContext = getDelegateContext(operationId);
CurrentOperationIdHolder.setCurrentOperationID(operationId);
try {
return executeReadOnlyOperation(operation, delegateContext.getManagementModel(), control, prepareStep, delegateContext);
} finally {
CurrentOperationIdHolder.setCurrentOperationID(null);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"ModelNode",
"executeReadOnlyOperation",
"(",
"final",
"ModelNode",
"operation",
",",
"final",
"OperationMessageHandler",
"handler",
",",
"final",
"OperationTransactionControl",
"control",
",",
"final",
"O... | Executes an operation on the controller latching onto an existing transaction
@param operation the operation
@param handler the handler
@param control the transaction control
@param prepareStep the prepare step to be executed before any other steps
@param operationId the id of the current transaction
@return the result of the operation | [
"Executes",
"an",
"operation",
"on",
"the",
"controller",
"latching",
"onto",
"an",
"existing",
"transaction"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java#L271-L280 | train |
wildfly/wildfly-core | domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpRequestProcessor.java | ManagementHttpRequestProcessor.addShutdownListener | public synchronized void addShutdownListener(ShutdownListener listener) {
if (state == CLOSED) {
listener.handleCompleted();
} else {
listeners.add(listener);
}
} | java | public synchronized void addShutdownListener(ShutdownListener listener) {
if (state == CLOSED) {
listener.handleCompleted();
} else {
listeners.add(listener);
}
} | [
"public",
"synchronized",
"void",
"addShutdownListener",
"(",
"ShutdownListener",
"listener",
")",
"{",
"if",
"(",
"state",
"==",
"CLOSED",
")",
"{",
"listener",
".",
"handleCompleted",
"(",
")",
";",
"}",
"else",
"{",
"listeners",
".",
"add",
"(",
"listener... | Add a shutdown listener, which gets called when all requests completed on shutdown.
@param listener the shutdown listener | [
"Add",
"a",
"shutdown",
"listener",
"which",
"gets",
"called",
"when",
"all",
"requests",
"completed",
"on",
"shutdown",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpRequestProcessor.java#L93-L99 | train |
wildfly/wildfly-core | domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpRequestProcessor.java | ManagementHttpRequestProcessor.handleCompleted | protected synchronized void handleCompleted() {
latch.countDown();
for (final ShutdownListener listener : listeners) {
listener.handleCompleted();
}
listeners.clear();
} | java | protected synchronized void handleCompleted() {
latch.countDown();
for (final ShutdownListener listener : listeners) {
listener.handleCompleted();
}
listeners.clear();
} | [
"protected",
"synchronized",
"void",
"handleCompleted",
"(",
")",
"{",
"latch",
".",
"countDown",
"(",
")",
";",
"for",
"(",
"final",
"ShutdownListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"handleCompleted",
"(",
")",
";",
"}",
"listene... | Notify all shutdown listeners that the shutdown completed. | [
"Notify",
"all",
"shutdown",
"listeners",
"that",
"the",
"shutdown",
"completed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/ManagementHttpRequestProcessor.java#L104-L110 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java | DeploymentResourceSupport.hasDeploymentSubsystemModel | public boolean hasDeploymentSubsystemModel(final String subsystemName) {
final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE);
final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName);
return root.hasChild(subsystem);
} | java | public boolean hasDeploymentSubsystemModel(final String subsystemName) {
final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE);
final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName);
return root.hasChild(subsystem);
} | [
"public",
"boolean",
"hasDeploymentSubsystemModel",
"(",
"final",
"String",
"subsystemName",
")",
"{",
"final",
"Resource",
"root",
"=",
"deploymentUnit",
".",
"getAttachment",
"(",
"DEPLOYMENT_RESOURCE",
")",
";",
"final",
"PathElement",
"subsystem",
"=",
"PathElemen... | Checks to see if a subsystem resource has already been registered for the deployment.
@param subsystemName the name of the subsystem
@return {@code true} if the subsystem exists on the deployment otherwise {@code false} | [
"Checks",
"to",
"see",
"if",
"a",
"subsystem",
"resource",
"has",
"already",
"been",
"registered",
"for",
"the",
"deployment",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L59-L63 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java | DeploymentResourceSupport.getDeploymentSubsystemModel | public ModelNode getDeploymentSubsystemModel(final String subsystemName) {
assert subsystemName != null : "The subsystemName cannot be null";
return getDeploymentSubModel(subsystemName, PathAddress.EMPTY_ADDRESS, null, deploymentUnit);
} | java | public ModelNode getDeploymentSubsystemModel(final String subsystemName) {
assert subsystemName != null : "The subsystemName cannot be null";
return getDeploymentSubModel(subsystemName, PathAddress.EMPTY_ADDRESS, null, deploymentUnit);
} | [
"public",
"ModelNode",
"getDeploymentSubsystemModel",
"(",
"final",
"String",
"subsystemName",
")",
"{",
"assert",
"subsystemName",
"!=",
"null",
":",
"\"The subsystemName cannot be null\"",
";",
"return",
"getDeploymentSubModel",
"(",
"subsystemName",
",",
"PathAddress",
... | Get the subsystem deployment model root.
<p>
If the subsystem resource does not exist one will be created.
</p>
@param subsystemName the subsystem name.
@return the model | [
"Get",
"the",
"subsystem",
"deployment",
"model",
"root",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L76-L79 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java | DeploymentResourceSupport.registerDeploymentSubsystemResource | public ModelNode registerDeploymentSubsystemResource(final String subsystemName, final Resource resource) {
assert subsystemName != null : "The subsystemName cannot be null";
assert resource != null : "The resource cannot be null";
return registerDeploymentSubResource(subsystemName, PathAddress.EMPTY_ADDRESS, resource);
} | java | public ModelNode registerDeploymentSubsystemResource(final String subsystemName, final Resource resource) {
assert subsystemName != null : "The subsystemName cannot be null";
assert resource != null : "The resource cannot be null";
return registerDeploymentSubResource(subsystemName, PathAddress.EMPTY_ADDRESS, resource);
} | [
"public",
"ModelNode",
"registerDeploymentSubsystemResource",
"(",
"final",
"String",
"subsystemName",
",",
"final",
"Resource",
"resource",
")",
"{",
"assert",
"subsystemName",
"!=",
"null",
":",
"\"The subsystemName cannot be null\"",
";",
"assert",
"resource",
"!=",
... | Registers the resource to the parent deployment resource. The model returned is that of the resource parameter.
@param subsystemName the subsystem name
@param resource the resource to be used for the subsystem on the deployment
@return the model
@throws java.lang.IllegalStateException if the subsystem resource already exists | [
"Registers",
"the",
"resource",
"to",
"the",
"parent",
"deployment",
"resource",
".",
"The",
"model",
"returned",
"is",
"that",
"of",
"the",
"resource",
"parameter",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L91-L95 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java | DeploymentResourceSupport.getOrCreateSubDeployment | static Resource getOrCreateSubDeployment(final String deploymentName, final DeploymentUnit parent) {
final Resource root = parent.getAttachment(DEPLOYMENT_RESOURCE);
return getOrCreate(root, PathElement.pathElement(SUBDEPLOYMENT, deploymentName));
} | java | static Resource getOrCreateSubDeployment(final String deploymentName, final DeploymentUnit parent) {
final Resource root = parent.getAttachment(DEPLOYMENT_RESOURCE);
return getOrCreate(root, PathElement.pathElement(SUBDEPLOYMENT, deploymentName));
} | [
"static",
"Resource",
"getOrCreateSubDeployment",
"(",
"final",
"String",
"deploymentName",
",",
"final",
"DeploymentUnit",
"parent",
")",
"{",
"final",
"Resource",
"root",
"=",
"parent",
".",
"getAttachment",
"(",
"DEPLOYMENT_RESOURCE",
")",
";",
"return",
"getOrCr... | Gets or creates the a resource for the sub-deployment on the parent deployments resource.
@param deploymentName the name of the deployment
@param parent the parent deployment used to find the parent resource
@return the already registered resource or a newly created resource | [
"Gets",
"or",
"creates",
"the",
"a",
"resource",
"for",
"the",
"sub",
"-",
"deployment",
"on",
"the",
"parent",
"deployments",
"resource",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L231-L234 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java | DeploymentResourceSupport.cleanup | static void cleanup(final Resource resource) {
synchronized (resource) {
for (final Resource.ResourceEntry entry : resource.getChildren(SUBSYSTEM)) {
resource.removeChild(entry.getPathElement());
}
for (final Resource.ResourceEntry entry : resource.getChildren(SUBDEPLOYMENT)) {
resource.removeChild(entry.getPathElement());
}
}
} | java | static void cleanup(final Resource resource) {
synchronized (resource) {
for (final Resource.ResourceEntry entry : resource.getChildren(SUBSYSTEM)) {
resource.removeChild(entry.getPathElement());
}
for (final Resource.ResourceEntry entry : resource.getChildren(SUBDEPLOYMENT)) {
resource.removeChild(entry.getPathElement());
}
}
} | [
"static",
"void",
"cleanup",
"(",
"final",
"Resource",
"resource",
")",
"{",
"synchronized",
"(",
"resource",
")",
"{",
"for",
"(",
"final",
"Resource",
".",
"ResourceEntry",
"entry",
":",
"resource",
".",
"getChildren",
"(",
"SUBSYSTEM",
")",
")",
"{",
"r... | Cleans up the subsystem children for the deployment and each sub-deployment resource.
@param resource the subsystem resource to clean up | [
"Cleans",
"up",
"the",
"subsystem",
"children",
"for",
"the",
"deployment",
"and",
"each",
"sub",
"-",
"deployment",
"resource",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/DeploymentResourceSupport.java#L241-L250 | train |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java | SystemPropertyContext.resolveBaseDir | Path resolveBaseDir(final String name, final String dirName) {
final String currentDir = SecurityActions.getPropertyPrivileged(name);
if (currentDir == null) {
return jbossHomeDir.resolve(dirName);
}
return Paths.get(currentDir);
} | java | Path resolveBaseDir(final String name, final String dirName) {
final String currentDir = SecurityActions.getPropertyPrivileged(name);
if (currentDir == null) {
return jbossHomeDir.resolve(dirName);
}
return Paths.get(currentDir);
} | [
"Path",
"resolveBaseDir",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"dirName",
")",
"{",
"final",
"String",
"currentDir",
"=",
"SecurityActions",
".",
"getPropertyPrivileged",
"(",
"name",
")",
";",
"if",
"(",
"currentDir",
"==",
"null",
")",
"... | Resolves the base directory. If the system property is set that value will be used. Otherwise the path is
resolved from the home directory.
@param name the system property name
@param dirName the directory name relative to the base directory
@return the resolved base directory | [
"Resolves",
"the",
"base",
"directory",
".",
"If",
"the",
"system",
"property",
"is",
"set",
"that",
"value",
"will",
"be",
"used",
".",
"Otherwise",
"the",
"path",
"is",
"resolved",
"from",
"the",
"home",
"directory",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java#L151-L157 | train |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java | SystemPropertyContext.resolvePath | static Path resolvePath(final Path base, final String... paths) {
return Paths.get(base.toString(), paths);
} | java | static Path resolvePath(final Path base, final String... paths) {
return Paths.get(base.toString(), paths);
} | [
"static",
"Path",
"resolvePath",
"(",
"final",
"Path",
"base",
",",
"final",
"String",
"...",
"paths",
")",
"{",
"return",
"Paths",
".",
"get",
"(",
"base",
".",
"toString",
"(",
")",
",",
"paths",
")",
";",
"}"
] | Resolves a path relative to the base path.
@param base the base path
@param paths paths relative to the base directory
@return the resolved path | [
"Resolves",
"a",
"path",
"relative",
"to",
"the",
"base",
"path",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java#L167-L169 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/operations/global/GlobalOperationHandlers.java | GlobalOperationHandlers.getChildAddresses | static Map<String, Set<String>> getChildAddresses(final OperationContext context, final PathAddress addr, final ImmutableManagementResourceRegistration registry, Resource resource, final String validChildType) {
Map<String, Set<String>> result = new HashMap<>();
Predicate<String> validChildTypeFilter = childType -> (validChildType == null) || validChildType.equals(childType);
if (resource != null) {
for (String childType : registry.getChildNames(PathAddress.EMPTY_ADDRESS)) {
if (validChildTypeFilter.test(childType)) {
List<String> list = new ArrayList<>();
for (String child : resource.getChildrenNames(childType)) {
if (registry.getSubModel(PathAddress.pathAddress(PathElement.pathElement(childType, child))) != null) {
list.add(child);
}
}
result.put(childType, new LinkedHashSet<>(list));
}
}
}
Set<PathElement> paths = registry.getChildAddresses(PathAddress.EMPTY_ADDRESS);
for (PathElement path : paths) {
String childType = path.getKey();
if (validChildTypeFilter.test(childType)) {
Set<String> children = result.get(childType);
if (children == null) {
// WFLY-3306 Ensure we have an entry for any valid child type
children = new LinkedHashSet<>();
result.put(childType, children);
}
ImmutableManagementResourceRegistration childRegistration = registry.getSubModel(PathAddress.pathAddress(path));
if (childRegistration != null) {
AliasEntry aliasEntry = childRegistration.getAliasEntry();
if (aliasEntry != null) {
PathAddress childAddr = addr.append(path);
PathAddress target = aliasEntry.convertToTargetAddress(childAddr, AliasContext.create(childAddr, context));
assert !childAddr.equals(target) : "Alias was not translated";
PathAddress targetParent = target.getParent();
Resource parentResource = context.readResourceFromRoot(targetParent, false);
if (parentResource != null) {
PathElement targetElement = target.getLastElement();
if (targetElement.isWildcard()) {
children.addAll(parentResource.getChildrenNames(targetElement.getKey()));
} else if (parentResource.hasChild(targetElement)) {
children.add(path.getValue());
}
}
}
if (!path.isWildcard() && childRegistration.isRemote()) {
children.add(path.getValue());
}
}
}
}
return result;
} | java | static Map<String, Set<String>> getChildAddresses(final OperationContext context, final PathAddress addr, final ImmutableManagementResourceRegistration registry, Resource resource, final String validChildType) {
Map<String, Set<String>> result = new HashMap<>();
Predicate<String> validChildTypeFilter = childType -> (validChildType == null) || validChildType.equals(childType);
if (resource != null) {
for (String childType : registry.getChildNames(PathAddress.EMPTY_ADDRESS)) {
if (validChildTypeFilter.test(childType)) {
List<String> list = new ArrayList<>();
for (String child : resource.getChildrenNames(childType)) {
if (registry.getSubModel(PathAddress.pathAddress(PathElement.pathElement(childType, child))) != null) {
list.add(child);
}
}
result.put(childType, new LinkedHashSet<>(list));
}
}
}
Set<PathElement> paths = registry.getChildAddresses(PathAddress.EMPTY_ADDRESS);
for (PathElement path : paths) {
String childType = path.getKey();
if (validChildTypeFilter.test(childType)) {
Set<String> children = result.get(childType);
if (children == null) {
// WFLY-3306 Ensure we have an entry for any valid child type
children = new LinkedHashSet<>();
result.put(childType, children);
}
ImmutableManagementResourceRegistration childRegistration = registry.getSubModel(PathAddress.pathAddress(path));
if (childRegistration != null) {
AliasEntry aliasEntry = childRegistration.getAliasEntry();
if (aliasEntry != null) {
PathAddress childAddr = addr.append(path);
PathAddress target = aliasEntry.convertToTargetAddress(childAddr, AliasContext.create(childAddr, context));
assert !childAddr.equals(target) : "Alias was not translated";
PathAddress targetParent = target.getParent();
Resource parentResource = context.readResourceFromRoot(targetParent, false);
if (parentResource != null) {
PathElement targetElement = target.getLastElement();
if (targetElement.isWildcard()) {
children.addAll(parentResource.getChildrenNames(targetElement.getKey()));
} else if (parentResource.hasChild(targetElement)) {
children.add(path.getValue());
}
}
}
if (!path.isWildcard() && childRegistration.isRemote()) {
children.add(path.getValue());
}
}
}
}
return result;
} | [
"static",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"getChildAddresses",
"(",
"final",
"OperationContext",
"context",
",",
"final",
"PathAddress",
"addr",
",",
"final",
"ImmutableManagementResourceRegistration",
"registry",
",",
"Resource",
"resourc... | Gets the addresses of the child resources under the given resource.
@param context the operation context
@param registry registry entry representing the resource
@param resource the current resource
@param validChildType a single child type to which the results should be limited. If {@code null} the result
should include all child types
@return map where the keys are the child types and the values are a set of child names associated with a type | [
"Gets",
"the",
"addresses",
"of",
"the",
"child",
"resources",
"under",
"the",
"given",
"resource",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/global/GlobalOperationHandlers.java#L1009-L1064 | train |
Comcast/jrugged | jrugged-core/src/main/java/org/fishwife/jrugged/interval/DiscreteInterval.java | DiscreteInterval.plus | public DiscreteInterval plus(DiscreteInterval other) {
return new DiscreteInterval(this.min + other.min, this.max + other.max);
} | java | public DiscreteInterval plus(DiscreteInterval other) {
return new DiscreteInterval(this.min + other.min, this.max + other.max);
} | [
"public",
"DiscreteInterval",
"plus",
"(",
"DiscreteInterval",
"other",
")",
"{",
"return",
"new",
"DiscreteInterval",
"(",
"this",
".",
"min",
"+",
"other",
".",
"min",
",",
"this",
".",
"max",
"+",
"other",
".",
"max",
")",
";",
"}"
] | Returns an interval representing the addition of the
given interval with this one.
@param other interval to add to this one
@return interval sum | [
"Returns",
"an",
"interval",
"representing",
"the",
"addition",
"of",
"the",
"given",
"interval",
"with",
"this",
"one",
"."
] | b6a5147c68ee733faf5616d49800abcbba67afe9 | https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-core/src/main/java/org/fishwife/jrugged/interval/DiscreteInterval.java#L74-L76 | train |
Comcast/jrugged | jrugged-core/src/main/java/org/fishwife/jrugged/interval/DiscreteInterval.java | DiscreteInterval.minus | public DiscreteInterval minus(DiscreteInterval other) {
return new DiscreteInterval(this.min - other.max, this.max - other.min);
} | java | public DiscreteInterval minus(DiscreteInterval other) {
return new DiscreteInterval(this.min - other.max, this.max - other.min);
} | [
"public",
"DiscreteInterval",
"minus",
"(",
"DiscreteInterval",
"other",
")",
"{",
"return",
"new",
"DiscreteInterval",
"(",
"this",
".",
"min",
"-",
"other",
".",
"max",
",",
"this",
".",
"max",
"-",
"other",
".",
"min",
")",
";",
"}"
] | Returns an interval representing the subtraction of the
given interval from this one.
@param other interval to subtract from this one
@return result of subtraction | [
"Returns",
"an",
"interval",
"representing",
"the",
"subtraction",
"of",
"the",
"given",
"interval",
"from",
"this",
"one",
"."
] | b6a5147c68ee733faf5616d49800abcbba67afe9 | https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-core/src/main/java/org/fishwife/jrugged/interval/DiscreteInterval.java#L91-L93 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.