id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
---|---|---|---|---|---|---|---|---|---|---|---|
158,700 |
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/Util.java
|
Util.validateRequest
|
public static ModelNode validateRequest(CommandContext ctx, ModelNode request) throws CommandFormatException {
final Set<String> keys = request.keys();
if (keys.size() == 2) { // no props
return null;
}
ModelNode outcome = (ModelNode) ctx.get(Scope.REQUEST, DESCRIPTION_RESPONSE);
if (outcome == null) {
outcome = retrieveDescription(ctx, request, true);
if (outcome == null) {
return null;
} else {
ctx.set(Scope.REQUEST, DESCRIPTION_RESPONSE, outcome);
}
}
if(!outcome.has(Util.RESULT)) {
throw new CommandFormatException("Failed to perform " + Util.READ_OPERATION_DESCRIPTION + " to validate the request: result is not available.");
}
final String operationName = request.get(Util.OPERATION).asString();
final ModelNode result = outcome.get(Util.RESULT);
final Set<String> definedProps = result.hasDefined(Util.REQUEST_PROPERTIES) ? result.get(Util.REQUEST_PROPERTIES).keys() : Collections.emptySet();
if(definedProps.isEmpty()) {
if(!(keys.size() == 3 && keys.contains(Util.OPERATION_HEADERS))) {
throw new CommandFormatException("Operation '" + operationName + "' does not expect any property.");
}
} else {
int skipped = 0;
for(String prop : keys) {
if(skipped < 2 && (prop.equals(Util.ADDRESS) || prop.equals(Util.OPERATION))) {
++skipped;
continue;
}
if(!definedProps.contains(prop)) {
if(!Util.OPERATION_HEADERS.equals(prop)) {
throw new CommandFormatException("'" + prop + "' is not found among the supported properties: " + definedProps);
}
}
}
}
return outcome;
}
|
java
|
public static ModelNode validateRequest(CommandContext ctx, ModelNode request) throws CommandFormatException {
final Set<String> keys = request.keys();
if (keys.size() == 2) { // no props
return null;
}
ModelNode outcome = (ModelNode) ctx.get(Scope.REQUEST, DESCRIPTION_RESPONSE);
if (outcome == null) {
outcome = retrieveDescription(ctx, request, true);
if (outcome == null) {
return null;
} else {
ctx.set(Scope.REQUEST, DESCRIPTION_RESPONSE, outcome);
}
}
if(!outcome.has(Util.RESULT)) {
throw new CommandFormatException("Failed to perform " + Util.READ_OPERATION_DESCRIPTION + " to validate the request: result is not available.");
}
final String operationName = request.get(Util.OPERATION).asString();
final ModelNode result = outcome.get(Util.RESULT);
final Set<String> definedProps = result.hasDefined(Util.REQUEST_PROPERTIES) ? result.get(Util.REQUEST_PROPERTIES).keys() : Collections.emptySet();
if(definedProps.isEmpty()) {
if(!(keys.size() == 3 && keys.contains(Util.OPERATION_HEADERS))) {
throw new CommandFormatException("Operation '" + operationName + "' does not expect any property.");
}
} else {
int skipped = 0;
for(String prop : keys) {
if(skipped < 2 && (prop.equals(Util.ADDRESS) || prop.equals(Util.OPERATION))) {
++skipped;
continue;
}
if(!definedProps.contains(prop)) {
if(!Util.OPERATION_HEADERS.equals(prop)) {
throw new CommandFormatException("'" + prop + "' is not found among the supported properties: " + definedProps);
}
}
}
}
return outcome;
}
|
[
"public",
"static",
"ModelNode",
"validateRequest",
"(",
"CommandContext",
"ctx",
",",
"ModelNode",
"request",
")",
"throws",
"CommandFormatException",
"{",
"final",
"Set",
"<",
"String",
">",
"keys",
"=",
"request",
".",
"keys",
"(",
")",
";",
"if",
"(",
"keys",
".",
"size",
"(",
")",
"==",
"2",
")",
"{",
"// no props",
"return",
"null",
";",
"}",
"ModelNode",
"outcome",
"=",
"(",
"ModelNode",
")",
"ctx",
".",
"get",
"(",
"Scope",
".",
"REQUEST",
",",
"DESCRIPTION_RESPONSE",
")",
";",
"if",
"(",
"outcome",
"==",
"null",
")",
"{",
"outcome",
"=",
"retrieveDescription",
"(",
"ctx",
",",
"request",
",",
"true",
")",
";",
"if",
"(",
"outcome",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"ctx",
".",
"set",
"(",
"Scope",
".",
"REQUEST",
",",
"DESCRIPTION_RESPONSE",
",",
"outcome",
")",
";",
"}",
"}",
"if",
"(",
"!",
"outcome",
".",
"has",
"(",
"Util",
".",
"RESULT",
")",
")",
"{",
"throw",
"new",
"CommandFormatException",
"(",
"\"Failed to perform \"",
"+",
"Util",
".",
"READ_OPERATION_DESCRIPTION",
"+",
"\" to validate the request: result is not available.\"",
")",
";",
"}",
"final",
"String",
"operationName",
"=",
"request",
".",
"get",
"(",
"Util",
".",
"OPERATION",
")",
".",
"asString",
"(",
")",
";",
"final",
"ModelNode",
"result",
"=",
"outcome",
".",
"get",
"(",
"Util",
".",
"RESULT",
")",
";",
"final",
"Set",
"<",
"String",
">",
"definedProps",
"=",
"result",
".",
"hasDefined",
"(",
"Util",
".",
"REQUEST_PROPERTIES",
")",
"?",
"result",
".",
"get",
"(",
"Util",
".",
"REQUEST_PROPERTIES",
")",
".",
"keys",
"(",
")",
":",
"Collections",
".",
"emptySet",
"(",
")",
";",
"if",
"(",
"definedProps",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"!",
"(",
"keys",
".",
"size",
"(",
")",
"==",
"3",
"&&",
"keys",
".",
"contains",
"(",
"Util",
".",
"OPERATION_HEADERS",
")",
")",
")",
"{",
"throw",
"new",
"CommandFormatException",
"(",
"\"Operation '\"",
"+",
"operationName",
"+",
"\"' does not expect any property.\"",
")",
";",
"}",
"}",
"else",
"{",
"int",
"skipped",
"=",
"0",
";",
"for",
"(",
"String",
"prop",
":",
"keys",
")",
"{",
"if",
"(",
"skipped",
"<",
"2",
"&&",
"(",
"prop",
".",
"equals",
"(",
"Util",
".",
"ADDRESS",
")",
"||",
"prop",
".",
"equals",
"(",
"Util",
".",
"OPERATION",
")",
")",
")",
"{",
"++",
"skipped",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"definedProps",
".",
"contains",
"(",
"prop",
")",
")",
"{",
"if",
"(",
"!",
"Util",
".",
"OPERATION_HEADERS",
".",
"equals",
"(",
"prop",
")",
")",
"{",
"throw",
"new",
"CommandFormatException",
"(",
"\"'\"",
"+",
"prop",
"+",
"\"' is not found among the supported properties: \"",
"+",
"definedProps",
")",
";",
"}",
"}",
"}",
"}",
"return",
"outcome",
";",
"}"
] |
return null if the operation has no params to validate
|
[
"return",
"null",
"if",
"the",
"operation",
"has",
"no",
"params",
"to",
"validate"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/Util.java#L1613-L1655
|
158,701 |
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/Util.java
|
Util.reconnectContext
|
public static boolean reconnectContext(RedirectException re, CommandContext ctx) {
boolean reconnected = false;
try {
ConnectionInfo info = ctx.getConnectionInfo();
ControllerAddress address = null;
if (info != null) {
address = info.getControllerAddress();
}
if (address != null && isHttpsRedirect(re, address.getProtocol())) {
LOG.debug("Trying to reconnect an http to http upgrade");
try {
ctx.connectController();
reconnected = true;
} catch (Exception ex) {
LOG.warn("Exception reconnecting", ex);
// Proper https redirect but error.
// Ignoring it.
}
}
} catch (URISyntaxException ex) {
LOG.warn("Invalid URI: ", ex);
// OK, invalid redirect.
}
return reconnected;
}
|
java
|
public static boolean reconnectContext(RedirectException re, CommandContext ctx) {
boolean reconnected = false;
try {
ConnectionInfo info = ctx.getConnectionInfo();
ControllerAddress address = null;
if (info != null) {
address = info.getControllerAddress();
}
if (address != null && isHttpsRedirect(re, address.getProtocol())) {
LOG.debug("Trying to reconnect an http to http upgrade");
try {
ctx.connectController();
reconnected = true;
} catch (Exception ex) {
LOG.warn("Exception reconnecting", ex);
// Proper https redirect but error.
// Ignoring it.
}
}
} catch (URISyntaxException ex) {
LOG.warn("Invalid URI: ", ex);
// OK, invalid redirect.
}
return reconnected;
}
|
[
"public",
"static",
"boolean",
"reconnectContext",
"(",
"RedirectException",
"re",
",",
"CommandContext",
"ctx",
")",
"{",
"boolean",
"reconnected",
"=",
"false",
";",
"try",
"{",
"ConnectionInfo",
"info",
"=",
"ctx",
".",
"getConnectionInfo",
"(",
")",
";",
"ControllerAddress",
"address",
"=",
"null",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"address",
"=",
"info",
".",
"getControllerAddress",
"(",
")",
";",
"}",
"if",
"(",
"address",
"!=",
"null",
"&&",
"isHttpsRedirect",
"(",
"re",
",",
"address",
".",
"getProtocol",
"(",
")",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Trying to reconnect an http to http upgrade\"",
")",
";",
"try",
"{",
"ctx",
".",
"connectController",
"(",
")",
";",
"reconnected",
"=",
"true",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Exception reconnecting\"",
",",
"ex",
")",
";",
"// Proper https redirect but error.",
"// Ignoring it.",
"}",
"}",
"}",
"catch",
"(",
"URISyntaxException",
"ex",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Invalid URI: \"",
",",
"ex",
")",
";",
"// OK, invalid redirect.",
"}",
"return",
"reconnected",
";",
"}"
] |
Reconnect the context if the RedirectException is valid.
|
[
"Reconnect",
"the",
"context",
"if",
"the",
"RedirectException",
"is",
"valid",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/Util.java#L1660-L1684
|
158,702 |
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/Util.java
|
Util.compactToString
|
public static String compactToString(ModelNode node) {
Objects.requireNonNull(node);
final StringWriter stringWriter = new StringWriter();
final PrintWriter writer = new PrintWriter(stringWriter, true);
node.writeString(writer, true);
return stringWriter.toString();
}
|
java
|
public static String compactToString(ModelNode node) {
Objects.requireNonNull(node);
final StringWriter stringWriter = new StringWriter();
final PrintWriter writer = new PrintWriter(stringWriter, true);
node.writeString(writer, true);
return stringWriter.toString();
}
|
[
"public",
"static",
"String",
"compactToString",
"(",
"ModelNode",
"node",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"node",
")",
";",
"final",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"stringWriter",
",",
"true",
")",
";",
"node",
".",
"writeString",
"(",
"writer",
",",
"true",
")",
";",
"return",
"stringWriter",
".",
"toString",
"(",
")",
";",
"}"
] |
Build a compact representation of the ModelNode.
@param node The model
@return A single line containing the multi lines ModelNode.toString() content.
|
[
"Build",
"a",
"compact",
"representation",
"of",
"the",
"ModelNode",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/Util.java#L1837-L1843
|
158,703 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java
|
S3Discovery.init
|
private void init() {
validatePreSignedUrls();
try {
conn = new AWSAuthConnection(access_key, secret_access_key);
// Determine the bucket name if prefix is set or if pre-signed URLs are being used
if (prefix != null && prefix.length() > 0) {
ListAllMyBucketsResponse bucket_list = conn.listAllMyBuckets(null);
List buckets = bucket_list.entries;
if (buckets != null) {
boolean found = false;
for (Object tmp : buckets) {
if (tmp instanceof Bucket) {
Bucket bucket = (Bucket) tmp;
if (bucket.name.startsWith(prefix)) {
location = bucket.name;
found = true;
}
}
}
if (!found) {
location = prefix + "-" + java.util.UUID.randomUUID().toString();
}
}
}
if (usingPreSignedUrls()) {
PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url);
location = parsedPut.getBucket();
}
if (!conn.checkBucketExists(location)) {
conn.createBucket(location, AWSAuthConnection.LOCATION_DEFAULT, null).connection.getResponseMessage();
}
} catch (Exception e) {
throw HostControllerLogger.ROOT_LOGGER.cannotAccessS3Bucket(location, e.getLocalizedMessage());
}
}
|
java
|
private void init() {
validatePreSignedUrls();
try {
conn = new AWSAuthConnection(access_key, secret_access_key);
// Determine the bucket name if prefix is set or if pre-signed URLs are being used
if (prefix != null && prefix.length() > 0) {
ListAllMyBucketsResponse bucket_list = conn.listAllMyBuckets(null);
List buckets = bucket_list.entries;
if (buckets != null) {
boolean found = false;
for (Object tmp : buckets) {
if (tmp instanceof Bucket) {
Bucket bucket = (Bucket) tmp;
if (bucket.name.startsWith(prefix)) {
location = bucket.name;
found = true;
}
}
}
if (!found) {
location = prefix + "-" + java.util.UUID.randomUUID().toString();
}
}
}
if (usingPreSignedUrls()) {
PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url);
location = parsedPut.getBucket();
}
if (!conn.checkBucketExists(location)) {
conn.createBucket(location, AWSAuthConnection.LOCATION_DEFAULT, null).connection.getResponseMessage();
}
} catch (Exception e) {
throw HostControllerLogger.ROOT_LOGGER.cannotAccessS3Bucket(location, e.getLocalizedMessage());
}
}
|
[
"private",
"void",
"init",
"(",
")",
"{",
"validatePreSignedUrls",
"(",
")",
";",
"try",
"{",
"conn",
"=",
"new",
"AWSAuthConnection",
"(",
"access_key",
",",
"secret_access_key",
")",
";",
"// Determine the bucket name if prefix is set or if pre-signed URLs are being used",
"if",
"(",
"prefix",
"!=",
"null",
"&&",
"prefix",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"ListAllMyBucketsResponse",
"bucket_list",
"=",
"conn",
".",
"listAllMyBuckets",
"(",
"null",
")",
";",
"List",
"buckets",
"=",
"bucket_list",
".",
"entries",
";",
"if",
"(",
"buckets",
"!=",
"null",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"Object",
"tmp",
":",
"buckets",
")",
"{",
"if",
"(",
"tmp",
"instanceof",
"Bucket",
")",
"{",
"Bucket",
"bucket",
"=",
"(",
"Bucket",
")",
"tmp",
";",
"if",
"(",
"bucket",
".",
"name",
".",
"startsWith",
"(",
"prefix",
")",
")",
"{",
"location",
"=",
"bucket",
".",
"name",
";",
"found",
"=",
"true",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"found",
")",
"{",
"location",
"=",
"prefix",
"+",
"\"-\"",
"+",
"java",
".",
"util",
".",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"}",
"}",
"if",
"(",
"usingPreSignedUrls",
"(",
")",
")",
"{",
"PreSignedUrlParser",
"parsedPut",
"=",
"new",
"PreSignedUrlParser",
"(",
"pre_signed_put_url",
")",
";",
"location",
"=",
"parsedPut",
".",
"getBucket",
"(",
")",
";",
"}",
"if",
"(",
"!",
"conn",
".",
"checkBucketExists",
"(",
"location",
")",
")",
"{",
"conn",
".",
"createBucket",
"(",
"location",
",",
"AWSAuthConnection",
".",
"LOCATION_DEFAULT",
",",
"null",
")",
".",
"connection",
".",
"getResponseMessage",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"cannotAccessS3Bucket",
"(",
"location",
",",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Do the set-up that's needed to access Amazon S3.
|
[
"Do",
"the",
"set",
"-",
"up",
"that",
"s",
"needed",
"to",
"access",
"Amazon",
"S3",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java#L210-L245
|
158,704 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java
|
S3Discovery.readFromFile
|
private List<DomainControllerData> readFromFile(String directoryName) {
List<DomainControllerData> data = new ArrayList<DomainControllerData>();
if (directoryName == null) {
return data;
}
if (conn == null) {
init();
}
try {
if (usingPreSignedUrls()) {
PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url);
directoryName = parsedPut.getPrefix();
}
String key = S3Util.sanitize(directoryName) + "/" + S3Util.sanitize(DC_FILE_NAME);
GetResponse val = conn.get(location, key, null);
if (val.object != null) {
byte[] buf = val.object.data;
if (buf != null && buf.length > 0) {
try {
data = S3Util.domainControllerDataFromByteBuffer(buf);
} catch (Exception e) {
throw HostControllerLogger.ROOT_LOGGER.failedMarshallingDomainControllerData();
}
}
}
return data;
} catch (IOException e) {
throw HostControllerLogger.ROOT_LOGGER.cannotAccessS3File(e.getLocalizedMessage());
}
}
|
java
|
private List<DomainControllerData> readFromFile(String directoryName) {
List<DomainControllerData> data = new ArrayList<DomainControllerData>();
if (directoryName == null) {
return data;
}
if (conn == null) {
init();
}
try {
if (usingPreSignedUrls()) {
PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url);
directoryName = parsedPut.getPrefix();
}
String key = S3Util.sanitize(directoryName) + "/" + S3Util.sanitize(DC_FILE_NAME);
GetResponse val = conn.get(location, key, null);
if (val.object != null) {
byte[] buf = val.object.data;
if (buf != null && buf.length > 0) {
try {
data = S3Util.domainControllerDataFromByteBuffer(buf);
} catch (Exception e) {
throw HostControllerLogger.ROOT_LOGGER.failedMarshallingDomainControllerData();
}
}
}
return data;
} catch (IOException e) {
throw HostControllerLogger.ROOT_LOGGER.cannotAccessS3File(e.getLocalizedMessage());
}
}
|
[
"private",
"List",
"<",
"DomainControllerData",
">",
"readFromFile",
"(",
"String",
"directoryName",
")",
"{",
"List",
"<",
"DomainControllerData",
">",
"data",
"=",
"new",
"ArrayList",
"<",
"DomainControllerData",
">",
"(",
")",
";",
"if",
"(",
"directoryName",
"==",
"null",
")",
"{",
"return",
"data",
";",
"}",
"if",
"(",
"conn",
"==",
"null",
")",
"{",
"init",
"(",
")",
";",
"}",
"try",
"{",
"if",
"(",
"usingPreSignedUrls",
"(",
")",
")",
"{",
"PreSignedUrlParser",
"parsedPut",
"=",
"new",
"PreSignedUrlParser",
"(",
"pre_signed_put_url",
")",
";",
"directoryName",
"=",
"parsedPut",
".",
"getPrefix",
"(",
")",
";",
"}",
"String",
"key",
"=",
"S3Util",
".",
"sanitize",
"(",
"directoryName",
")",
"+",
"\"/\"",
"+",
"S3Util",
".",
"sanitize",
"(",
"DC_FILE_NAME",
")",
";",
"GetResponse",
"val",
"=",
"conn",
".",
"get",
"(",
"location",
",",
"key",
",",
"null",
")",
";",
"if",
"(",
"val",
".",
"object",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"val",
".",
"object",
".",
"data",
";",
"if",
"(",
"buf",
"!=",
"null",
"&&",
"buf",
".",
"length",
">",
"0",
")",
"{",
"try",
"{",
"data",
"=",
"S3Util",
".",
"domainControllerDataFromByteBuffer",
"(",
"buf",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"failedMarshallingDomainControllerData",
"(",
")",
";",
"}",
"}",
"}",
"return",
"data",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"cannotAccessS3File",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Read the domain controller data from an S3 file.
@param directoryName the name of the directory in the bucket that contains the S3 file
@return the domain controller data
|
[
"Read",
"the",
"domain",
"controller",
"data",
"from",
"an",
"S3",
"file",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java#L253-L284
|
158,705 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java
|
S3Discovery.writeToFile
|
private void writeToFile(List<DomainControllerData> data, String domainName) throws IOException {
if(domainName == null || data == null) {
return;
}
if (conn == null) {
init();
}
try {
String key = S3Util.sanitize(domainName) + "/" + S3Util.sanitize(DC_FILE_NAME);
byte[] buf = S3Util.domainControllerDataToByteBuffer(data);
S3Object val = new S3Object(buf, null);
if (usingPreSignedUrls()) {
Map headers = new TreeMap();
headers.put("x-amz-acl", Arrays.asList("public-read"));
conn.put(pre_signed_put_url, val, headers).connection.getResponseMessage();
} else {
Map headers = new TreeMap();
headers.put("Content-Type", Arrays.asList("text/plain"));
conn.put(location, key, val, headers).connection.getResponseMessage();
}
}
catch(Exception e) {
throw HostControllerLogger.ROOT_LOGGER.cannotWriteToS3File(e.getLocalizedMessage());
}
}
|
java
|
private void writeToFile(List<DomainControllerData> data, String domainName) throws IOException {
if(domainName == null || data == null) {
return;
}
if (conn == null) {
init();
}
try {
String key = S3Util.sanitize(domainName) + "/" + S3Util.sanitize(DC_FILE_NAME);
byte[] buf = S3Util.domainControllerDataToByteBuffer(data);
S3Object val = new S3Object(buf, null);
if (usingPreSignedUrls()) {
Map headers = new TreeMap();
headers.put("x-amz-acl", Arrays.asList("public-read"));
conn.put(pre_signed_put_url, val, headers).connection.getResponseMessage();
} else {
Map headers = new TreeMap();
headers.put("Content-Type", Arrays.asList("text/plain"));
conn.put(location, key, val, headers).connection.getResponseMessage();
}
}
catch(Exception e) {
throw HostControllerLogger.ROOT_LOGGER.cannotWriteToS3File(e.getLocalizedMessage());
}
}
|
[
"private",
"void",
"writeToFile",
"(",
"List",
"<",
"DomainControllerData",
">",
"data",
",",
"String",
"domainName",
")",
"throws",
"IOException",
"{",
"if",
"(",
"domainName",
"==",
"null",
"||",
"data",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"conn",
"==",
"null",
")",
"{",
"init",
"(",
")",
";",
"}",
"try",
"{",
"String",
"key",
"=",
"S3Util",
".",
"sanitize",
"(",
"domainName",
")",
"+",
"\"/\"",
"+",
"S3Util",
".",
"sanitize",
"(",
"DC_FILE_NAME",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"S3Util",
".",
"domainControllerDataToByteBuffer",
"(",
"data",
")",
";",
"S3Object",
"val",
"=",
"new",
"S3Object",
"(",
"buf",
",",
"null",
")",
";",
"if",
"(",
"usingPreSignedUrls",
"(",
")",
")",
"{",
"Map",
"headers",
"=",
"new",
"TreeMap",
"(",
")",
";",
"headers",
".",
"put",
"(",
"\"x-amz-acl\"",
",",
"Arrays",
".",
"asList",
"(",
"\"public-read\"",
")",
")",
";",
"conn",
".",
"put",
"(",
"pre_signed_put_url",
",",
"val",
",",
"headers",
")",
".",
"connection",
".",
"getResponseMessage",
"(",
")",
";",
"}",
"else",
"{",
"Map",
"headers",
"=",
"new",
"TreeMap",
"(",
")",
";",
"headers",
".",
"put",
"(",
"\"Content-Type\"",
",",
"Arrays",
".",
"asList",
"(",
"\"text/plain\"",
")",
")",
";",
"conn",
".",
"put",
"(",
"location",
",",
"key",
",",
"val",
",",
"headers",
")",
".",
"connection",
".",
"getResponseMessage",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"cannotWriteToS3File",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Write the domain controller data to an S3 file.
@param data the domain controller data
@param domainName the name of the directory in the bucket to write the S3 file to
@throws IOException
|
[
"Write",
"the",
"domain",
"controller",
"data",
"to",
"an",
"S3",
"file",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java#L293-L319
|
158,706 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java
|
S3Discovery.remove
|
private void remove(String directoryName) {
if ((directoryName == null) || (conn == null))
return;
String key = S3Util.sanitize(directoryName) + "/" + S3Util.sanitize(DC_FILE_NAME);
try {
Map headers = new TreeMap();
headers.put("Content-Type", Arrays.asList("text/plain"));
if (usingPreSignedUrls()) {
conn.delete(pre_signed_delete_url).connection.getResponseMessage();
} else {
conn.delete(location, key, headers).connection.getResponseMessage();
}
}
catch(Exception e) {
ROOT_LOGGER.cannotRemoveS3File(e);
}
}
|
java
|
private void remove(String directoryName) {
if ((directoryName == null) || (conn == null))
return;
String key = S3Util.sanitize(directoryName) + "/" + S3Util.sanitize(DC_FILE_NAME);
try {
Map headers = new TreeMap();
headers.put("Content-Type", Arrays.asList("text/plain"));
if (usingPreSignedUrls()) {
conn.delete(pre_signed_delete_url).connection.getResponseMessage();
} else {
conn.delete(location, key, headers).connection.getResponseMessage();
}
}
catch(Exception e) {
ROOT_LOGGER.cannotRemoveS3File(e);
}
}
|
[
"private",
"void",
"remove",
"(",
"String",
"directoryName",
")",
"{",
"if",
"(",
"(",
"directoryName",
"==",
"null",
")",
"||",
"(",
"conn",
"==",
"null",
")",
")",
"return",
";",
"String",
"key",
"=",
"S3Util",
".",
"sanitize",
"(",
"directoryName",
")",
"+",
"\"/\"",
"+",
"S3Util",
".",
"sanitize",
"(",
"DC_FILE_NAME",
")",
";",
"try",
"{",
"Map",
"headers",
"=",
"new",
"TreeMap",
"(",
")",
";",
"headers",
".",
"put",
"(",
"\"Content-Type\"",
",",
"Arrays",
".",
"asList",
"(",
"\"text/plain\"",
")",
")",
";",
"if",
"(",
"usingPreSignedUrls",
"(",
")",
")",
"{",
"conn",
".",
"delete",
"(",
"pre_signed_delete_url",
")",
".",
"connection",
".",
"getResponseMessage",
"(",
")",
";",
"}",
"else",
"{",
"conn",
".",
"delete",
"(",
"location",
",",
"key",
",",
"headers",
")",
".",
"connection",
".",
"getResponseMessage",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"ROOT_LOGGER",
".",
"cannotRemoveS3File",
"(",
"e",
")",
";",
"}",
"}"
] |
Remove the S3 file that contains the domain controller data.
@param directoryName the name of the directory that contains the S3 file
|
[
"Remove",
"the",
"S3",
"file",
"that",
"contains",
"the",
"domain",
"controller",
"data",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/discovery/S3Discovery.java#L326-L343
|
158,707 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/registry/GlobalTransformerRegistry.java
|
GlobalTransformerRegistry.mergeSubtree
|
public void mergeSubtree(final OperationTransformerRegistry targetRegistry, final Map<PathAddress, ModelVersion> subTree) {
for(Map.Entry<PathAddress, ModelVersion> entry: subTree.entrySet()) {
mergeSubtree(targetRegistry, entry.getKey(), entry.getValue());
}
}
|
java
|
public void mergeSubtree(final OperationTransformerRegistry targetRegistry, final Map<PathAddress, ModelVersion> subTree) {
for(Map.Entry<PathAddress, ModelVersion> entry: subTree.entrySet()) {
mergeSubtree(targetRegistry, entry.getKey(), entry.getValue());
}
}
|
[
"public",
"void",
"mergeSubtree",
"(",
"final",
"OperationTransformerRegistry",
"targetRegistry",
",",
"final",
"Map",
"<",
"PathAddress",
",",
"ModelVersion",
">",
"subTree",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"PathAddress",
",",
"ModelVersion",
">",
"entry",
":",
"subTree",
".",
"entrySet",
"(",
")",
")",
"{",
"mergeSubtree",
"(",
"targetRegistry",
",",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] |
Merge a subtree.
@param targetRegistry the target registry
@param subTree the subtree
|
[
"Merge",
"a",
"subtree",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/GlobalTransformerRegistry.java#L152-L156
|
158,708 |
wildfly/wildfly-core
|
logging/src/main/java/org/jboss/as/logging/handlers/HandlerOperations.java
|
HandlerOperations.isDisabledHandler
|
private static boolean isDisabledHandler(final LogContext logContext, final String handlerName) {
final Map<String, String> disableHandlers = logContext.getAttachment(CommonAttributes.ROOT_LOGGER_NAME, DISABLED_HANDLERS_KEY);
return disableHandlers != null && disableHandlers.containsKey(handlerName);
}
|
java
|
private static boolean isDisabledHandler(final LogContext logContext, final String handlerName) {
final Map<String, String> disableHandlers = logContext.getAttachment(CommonAttributes.ROOT_LOGGER_NAME, DISABLED_HANDLERS_KEY);
return disableHandlers != null && disableHandlers.containsKey(handlerName);
}
|
[
"private",
"static",
"boolean",
"isDisabledHandler",
"(",
"final",
"LogContext",
"logContext",
",",
"final",
"String",
"handlerName",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"disableHandlers",
"=",
"logContext",
".",
"getAttachment",
"(",
"CommonAttributes",
".",
"ROOT_LOGGER_NAME",
",",
"DISABLED_HANDLERS_KEY",
")",
";",
"return",
"disableHandlers",
"!=",
"null",
"&&",
"disableHandlers",
".",
"containsKey",
"(",
"handlerName",
")",
";",
"}"
] |
Checks to see if a handler is disabled
@param handlerName the name of the handler to enable.
|
[
"Checks",
"to",
"see",
"if",
"a",
"handler",
"is",
"disabled"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/handlers/HandlerOperations.java#L866-L869
|
158,709 |
wildfly/wildfly-core
|
jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java
|
ObjectNameAddressUtil.toPathAddress
|
static PathAddress toPathAddress(String domain, ImmutableManagementResourceRegistration registry, ObjectName name) {
if (!name.getDomain().equals(domain)) {
return PathAddress.EMPTY_ADDRESS;
}
if (name.equals(ModelControllerMBeanHelper.createRootObjectName(domain))) {
return PathAddress.EMPTY_ADDRESS;
}
final Hashtable<String, String> properties = name.getKeyPropertyList();
return searchPathAddress(PathAddress.EMPTY_ADDRESS, registry, properties);
}
|
java
|
static PathAddress toPathAddress(String domain, ImmutableManagementResourceRegistration registry, ObjectName name) {
if (!name.getDomain().equals(domain)) {
return PathAddress.EMPTY_ADDRESS;
}
if (name.equals(ModelControllerMBeanHelper.createRootObjectName(domain))) {
return PathAddress.EMPTY_ADDRESS;
}
final Hashtable<String, String> properties = name.getKeyPropertyList();
return searchPathAddress(PathAddress.EMPTY_ADDRESS, registry, properties);
}
|
[
"static",
"PathAddress",
"toPathAddress",
"(",
"String",
"domain",
",",
"ImmutableManagementResourceRegistration",
"registry",
",",
"ObjectName",
"name",
")",
"{",
"if",
"(",
"!",
"name",
".",
"getDomain",
"(",
")",
".",
"equals",
"(",
"domain",
")",
")",
"{",
"return",
"PathAddress",
".",
"EMPTY_ADDRESS",
";",
"}",
"if",
"(",
"name",
".",
"equals",
"(",
"ModelControllerMBeanHelper",
".",
"createRootObjectName",
"(",
"domain",
")",
")",
")",
"{",
"return",
"PathAddress",
".",
"EMPTY_ADDRESS",
";",
"}",
"final",
"Hashtable",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"name",
".",
"getKeyPropertyList",
"(",
")",
";",
"return",
"searchPathAddress",
"(",
"PathAddress",
".",
"EMPTY_ADDRESS",
",",
"registry",
",",
"properties",
")",
";",
"}"
] |
Straight conversion from an ObjectName to a PathAddress.
There may not necessarily be a Resource at this path address (if that correspond to a pattern) but it must
match a model in the registry.
@param domain the name of the caller's JMX domain
@param registry the root resource for the management model
@param name the ObjectName to convert
@return the PathAddress, or {@code null} if no address matches the object name
|
[
"Straight",
"conversion",
"from",
"an",
"ObjectName",
"to",
"a",
"PathAddress",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java#L238-L247
|
158,710 |
wildfly/wildfly-core
|
io/subsystem/src/main/java/org/wildfly/extension/io/WorkerService.java
|
WorkerService.stopDone
|
private void stopDone() {
synchronized (stopLock) {
final StopContext stopContext = this.stopContext;
this.stopContext = null;
if (stopContext != null) {
stopContext.complete();
}
stopLock.notifyAll();
}
}
|
java
|
private void stopDone() {
synchronized (stopLock) {
final StopContext stopContext = this.stopContext;
this.stopContext = null;
if (stopContext != null) {
stopContext.complete();
}
stopLock.notifyAll();
}
}
|
[
"private",
"void",
"stopDone",
"(",
")",
"{",
"synchronized",
"(",
"stopLock",
")",
"{",
"final",
"StopContext",
"stopContext",
"=",
"this",
".",
"stopContext",
";",
"this",
".",
"stopContext",
"=",
"null",
";",
"if",
"(",
"stopContext",
"!=",
"null",
")",
"{",
"stopContext",
".",
"complete",
"(",
")",
";",
"}",
"stopLock",
".",
"notifyAll",
"(",
")",
";",
"}",
"}"
] |
Callback from the worker when it terminates
|
[
"Callback",
"from",
"the",
"worker",
"when",
"it",
"terminates"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/io/subsystem/src/main/java/org/wildfly/extension/io/WorkerService.java#L128-L137
|
158,711 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/description/DefaultCheckersAndConverter.java
|
DefaultCheckersAndConverter.getRejectionLogMessageId
|
public String getRejectionLogMessageId() {
String id = logMessageId;
if (id == null) {
id = getRejectionLogMessage(Collections.<String, ModelNode>emptyMap());
}
logMessageId = id;
return logMessageId;
}
|
java
|
public String getRejectionLogMessageId() {
String id = logMessageId;
if (id == null) {
id = getRejectionLogMessage(Collections.<String, ModelNode>emptyMap());
}
logMessageId = id;
return logMessageId;
}
|
[
"public",
"String",
"getRejectionLogMessageId",
"(",
")",
"{",
"String",
"id",
"=",
"logMessageId",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"id",
"=",
"getRejectionLogMessage",
"(",
"Collections",
".",
"<",
"String",
",",
"ModelNode",
">",
"emptyMap",
"(",
")",
")",
";",
"}",
"logMessageId",
"=",
"id",
";",
"return",
"logMessageId",
";",
"}"
] |
Returns the log message id used by this checker. This is used to group it so that all attributes failing a type of rejction
end up in the same error message. This default implementation uses the formatted log message with an empty attribute map as the id.
@return the log message id
|
[
"Returns",
"the",
"log",
"message",
"id",
"used",
"by",
"this",
"checker",
".",
"This",
"is",
"used",
"to",
"group",
"it",
"so",
"that",
"all",
"attributes",
"failing",
"a",
"type",
"of",
"rejction",
"end",
"up",
"in",
"the",
"same",
"error",
"message",
".",
"This",
"default",
"implementation",
"uses",
"the",
"formatted",
"log",
"message",
"with",
"an",
"empty",
"attribute",
"map",
"as",
"the",
"id",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/description/DefaultCheckersAndConverter.java#L94-L101
|
158,712 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/ServerInventoryService.java
|
ServerInventoryService.stop
|
@Override
public synchronized void stop(final StopContext context) {
final boolean shutdownServers = runningModeControl.getRestartMode() == RestartMode.SERVERS;
if (shutdownServers) {
Runnable task = new Runnable() {
@Override
public void run() {
try {
serverInventory.shutdown(true, -1, true); // TODO graceful shutdown
serverInventory = null;
// client.getValue().setServerInventory(null);
} finally {
serverCallback.getValue().setCallbackHandler(null);
context.complete();
}
}
};
try {
executorService.getValue().execute(task);
} catch (RejectedExecutionException e) {
task.run();
} finally {
context.asynchronous();
}
} else {
// We have to set the shutdown flag in any case
serverInventory.shutdown(false, -1, true);
serverInventory = null;
}
}
|
java
|
@Override
public synchronized void stop(final StopContext context) {
final boolean shutdownServers = runningModeControl.getRestartMode() == RestartMode.SERVERS;
if (shutdownServers) {
Runnable task = new Runnable() {
@Override
public void run() {
try {
serverInventory.shutdown(true, -1, true); // TODO graceful shutdown
serverInventory = null;
// client.getValue().setServerInventory(null);
} finally {
serverCallback.getValue().setCallbackHandler(null);
context.complete();
}
}
};
try {
executorService.getValue().execute(task);
} catch (RejectedExecutionException e) {
task.run();
} finally {
context.asynchronous();
}
} else {
// We have to set the shutdown flag in any case
serverInventory.shutdown(false, -1, true);
serverInventory = null;
}
}
|
[
"@",
"Override",
"public",
"synchronized",
"void",
"stop",
"(",
"final",
"StopContext",
"context",
")",
"{",
"final",
"boolean",
"shutdownServers",
"=",
"runningModeControl",
".",
"getRestartMode",
"(",
")",
"==",
"RestartMode",
".",
"SERVERS",
";",
"if",
"(",
"shutdownServers",
")",
"{",
"Runnable",
"task",
"=",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"serverInventory",
".",
"shutdown",
"(",
"true",
",",
"-",
"1",
",",
"true",
")",
";",
"// TODO graceful shutdown",
"serverInventory",
"=",
"null",
";",
"// client.getValue().setServerInventory(null);",
"}",
"finally",
"{",
"serverCallback",
".",
"getValue",
"(",
")",
".",
"setCallbackHandler",
"(",
"null",
")",
";",
"context",
".",
"complete",
"(",
")",
";",
"}",
"}",
"}",
";",
"try",
"{",
"executorService",
".",
"getValue",
"(",
")",
".",
"execute",
"(",
"task",
")",
";",
"}",
"catch",
"(",
"RejectedExecutionException",
"e",
")",
"{",
"task",
".",
"run",
"(",
")",
";",
"}",
"finally",
"{",
"context",
".",
"asynchronous",
"(",
")",
";",
"}",
"}",
"else",
"{",
"// We have to set the shutdown flag in any case",
"serverInventory",
".",
"shutdown",
"(",
"false",
",",
"-",
"1",
",",
"true",
")",
";",
"serverInventory",
"=",
"null",
";",
"}",
"}"
] |
Stops all servers.
{@inheritDoc}
|
[
"Stops",
"all",
"servers",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ServerInventoryService.java#L134-L163
|
158,713 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/ignored/IgnoredDomainResourceRegistry.java
|
IgnoredDomainResourceRegistry.isResourceExcluded
|
public boolean isResourceExcluded(final PathAddress address) {
if (!localHostControllerInfo.isMasterDomainController() && address.size() > 0) {
IgnoredDomainResourceRoot root = this.rootResource;
PathElement firstElement = address.getElement(0);
IgnoreDomainResourceTypeResource typeResource = root == null ? null : root.getChildInternal(firstElement.getKey());
if (typeResource != null) {
if (typeResource.hasName(firstElement.getValue())) {
return true;
}
}
}
return false;
}
|
java
|
public boolean isResourceExcluded(final PathAddress address) {
if (!localHostControllerInfo.isMasterDomainController() && address.size() > 0) {
IgnoredDomainResourceRoot root = this.rootResource;
PathElement firstElement = address.getElement(0);
IgnoreDomainResourceTypeResource typeResource = root == null ? null : root.getChildInternal(firstElement.getKey());
if (typeResource != null) {
if (typeResource.hasName(firstElement.getValue())) {
return true;
}
}
}
return false;
}
|
[
"public",
"boolean",
"isResourceExcluded",
"(",
"final",
"PathAddress",
"address",
")",
"{",
"if",
"(",
"!",
"localHostControllerInfo",
".",
"isMasterDomainController",
"(",
")",
"&&",
"address",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"IgnoredDomainResourceRoot",
"root",
"=",
"this",
".",
"rootResource",
";",
"PathElement",
"firstElement",
"=",
"address",
".",
"getElement",
"(",
"0",
")",
";",
"IgnoreDomainResourceTypeResource",
"typeResource",
"=",
"root",
"==",
"null",
"?",
"null",
":",
"root",
".",
"getChildInternal",
"(",
"firstElement",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"typeResource",
"!=",
"null",
")",
"{",
"if",
"(",
"typeResource",
".",
"hasName",
"(",
"firstElement",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns whether this host should ignore operations from the master domain controller that target
the given address.
@param address the resource address. Cannot be {@code null}
@return {@code true} if the operation should be ignored; {@code false} otherwise
|
[
"Returns",
"whether",
"this",
"host",
"should",
"ignore",
"operations",
"from",
"the",
"master",
"domain",
"controller",
"that",
"target",
"the",
"given",
"address",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ignored/IgnoredDomainResourceRegistry.java#L72-L84
|
158,714 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/mgmt/DomainHostExcludeRegistry.java
|
DomainHostExcludeRegistry.getVersionIgnoreData
|
VersionExcludeData getVersionIgnoreData(int major, int minor, int micro) {
VersionExcludeData result = registry.get(new VersionKey(major, minor, micro));
if (result == null) {
result = registry.get(new VersionKey(major, minor, null));
}
return result;
}
|
java
|
VersionExcludeData getVersionIgnoreData(int major, int minor, int micro) {
VersionExcludeData result = registry.get(new VersionKey(major, minor, micro));
if (result == null) {
result = registry.get(new VersionKey(major, minor, null));
}
return result;
}
|
[
"VersionExcludeData",
"getVersionIgnoreData",
"(",
"int",
"major",
",",
"int",
"minor",
",",
"int",
"micro",
")",
"{",
"VersionExcludeData",
"result",
"=",
"registry",
".",
"get",
"(",
"new",
"VersionKey",
"(",
"major",
",",
"minor",
",",
"micro",
")",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"registry",
".",
"get",
"(",
"new",
"VersionKey",
"(",
"major",
",",
"minor",
",",
"null",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Gets the host-ignore data for a slave host running the given version.
@param major the kernel management API major version
@param minor the kernel management API minor version
@param micro the kernel management API micro version
@return the host-ignore data, or {@code null} if there is no matching registration
|
[
"Gets",
"the",
"host",
"-",
"ignore",
"data",
"for",
"a",
"slave",
"host",
"running",
"the",
"given",
"version",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/mgmt/DomainHostExcludeRegistry.java#L144-L150
|
158,715 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
|
PathUtil.copyRecursively
|
public static void copyRecursively(final Path source, final Path target, boolean overwrite) throws IOException {
final CopyOption[] options;
if (overwrite) {
options = new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING};
} else {
options = new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES};
}
Files.walkFileTree(source, new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Files.copy(dir, target.resolve(source.relativize(dir)), options);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.copy(file, target.resolve(source.relativize(file)), options);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
DeploymentRepositoryLogger.ROOT_LOGGER.cannotCopyFile(exc, file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
return FileVisitResult.CONTINUE;
}
});
}
|
java
|
public static void copyRecursively(final Path source, final Path target, boolean overwrite) throws IOException {
final CopyOption[] options;
if (overwrite) {
options = new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING};
} else {
options = new CopyOption[]{StandardCopyOption.COPY_ATTRIBUTES};
}
Files.walkFileTree(source, new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Files.copy(dir, target.resolve(source.relativize(dir)), options);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.copy(file, target.resolve(source.relativize(file)), options);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
DeploymentRepositoryLogger.ROOT_LOGGER.cannotCopyFile(exc, file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
return FileVisitResult.CONTINUE;
}
});
}
|
[
"public",
"static",
"void",
"copyRecursively",
"(",
"final",
"Path",
"source",
",",
"final",
"Path",
"target",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"final",
"CopyOption",
"[",
"]",
"options",
";",
"if",
"(",
"overwrite",
")",
"{",
"options",
"=",
"new",
"CopyOption",
"[",
"]",
"{",
"StandardCopyOption",
".",
"COPY_ATTRIBUTES",
",",
"StandardCopyOption",
".",
"REPLACE_EXISTING",
"}",
";",
"}",
"else",
"{",
"options",
"=",
"new",
"CopyOption",
"[",
"]",
"{",
"StandardCopyOption",
".",
"COPY_ATTRIBUTES",
"}",
";",
"}",
"Files",
".",
"walkFileTree",
"(",
"source",
",",
"new",
"FileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"preVisitDirectory",
"(",
"Path",
"dir",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"copy",
"(",
"dir",
",",
"target",
".",
"resolve",
"(",
"source",
".",
"relativize",
"(",
"dir",
")",
")",
",",
"options",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"Path",
"file",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"copy",
"(",
"file",
",",
"target",
".",
"resolve",
"(",
"source",
".",
"relativize",
"(",
"file",
")",
")",
",",
"options",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"visitFileFailed",
"(",
"Path",
"file",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"DeploymentRepositoryLogger",
".",
"ROOT_LOGGER",
".",
"cannotCopyFile",
"(",
"exc",
",",
"file",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"Path",
"dir",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"}",
")",
";",
"}"
] |
Copy a path recursively.
@param source a Path pointing to a file or a directory that must exist
@param target a Path pointing to a directory where the contents will be copied.
@param overwrite overwrite existing files - if set to false fails if the target file already exists.
@throws IOException
|
[
"Copy",
"a",
"path",
"recursively",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L53-L84
|
158,716 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
|
PathUtil.deleteSilentlyRecursively
|
public static void deleteSilentlyRecursively(final Path path) {
if (path != null) {
try {
deleteRecursively(path);
} catch (IOException ioex) {
DeploymentRepositoryLogger.ROOT_LOGGER.cannotDeleteFile(ioex, path);
}
}
}
|
java
|
public static void deleteSilentlyRecursively(final Path path) {
if (path != null) {
try {
deleteRecursively(path);
} catch (IOException ioex) {
DeploymentRepositoryLogger.ROOT_LOGGER.cannotDeleteFile(ioex, path);
}
}
}
|
[
"public",
"static",
"void",
"deleteSilentlyRecursively",
"(",
"final",
"Path",
"path",
")",
"{",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"try",
"{",
"deleteRecursively",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioex",
")",
"{",
"DeploymentRepositoryLogger",
".",
"ROOT_LOGGER",
".",
"cannotDeleteFile",
"(",
"ioex",
",",
"path",
")",
";",
"}",
"}",
"}"
] |
Delete a path recursively, not throwing Exception if it fails or if the path is null.
@param path a Path pointing to a file or a directory that may not exists anymore.
|
[
"Delete",
"a",
"path",
"recursively",
"not",
"throwing",
"Exception",
"if",
"it",
"fails",
"or",
"if",
"the",
"path",
"is",
"null",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L90-L98
|
158,717 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
|
PathUtil.deleteRecursively
|
public static void deleteRecursively(final Path path) throws IOException {
DeploymentRepositoryLogger.ROOT_LOGGER.debugf("Deleting %s recursively", path);
if (Files.exists(path)) {
Files.walkFileTree(path, new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
DeploymentRepositoryLogger.ROOT_LOGGER.cannotDeleteFile(exc, path);
throw exc;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
}
|
java
|
public static void deleteRecursively(final Path path) throws IOException {
DeploymentRepositoryLogger.ROOT_LOGGER.debugf("Deleting %s recursively", path);
if (Files.exists(path)) {
Files.walkFileTree(path, new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
DeploymentRepositoryLogger.ROOT_LOGGER.cannotDeleteFile(exc, path);
throw exc;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
}
|
[
"public",
"static",
"void",
"deleteRecursively",
"(",
"final",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"DeploymentRepositoryLogger",
".",
"ROOT_LOGGER",
".",
"debugf",
"(",
"\"Deleting %s recursively\"",
",",
"path",
")",
";",
"if",
"(",
"Files",
".",
"exists",
"(",
"path",
")",
")",
"{",
"Files",
".",
"walkFileTree",
"(",
"path",
",",
"new",
"FileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"preVisitDirectory",
"(",
"Path",
"dir",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"Path",
"file",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"file",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"visitFileFailed",
"(",
"Path",
"file",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"DeploymentRepositoryLogger",
".",
"ROOT_LOGGER",
".",
"cannotDeleteFile",
"(",
"exc",
",",
"path",
")",
";",
"throw",
"exc",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"Path",
"dir",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"dir",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"}",
")",
";",
"}",
"}"
] |
Delete a path recursively.
@param path a Path pointing to a file or a directory that may not exists anymore.
@throws IOException
|
[
"Delete",
"a",
"path",
"recursively",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L105-L133
|
158,718 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
|
PathUtil.resolveSecurely
|
public static final Path resolveSecurely(Path rootPath, String path) {
Path resolvedPath;
if(path == null || path.isEmpty()) {
resolvedPath = rootPath.normalize();
} else {
String relativePath = removeSuperflousSlashes(path);
resolvedPath = rootPath.resolve(relativePath).normalize();
}
if(!resolvedPath.startsWith(rootPath)) {
throw DeploymentRepositoryLogger.ROOT_LOGGER.forbiddenPath(path);
}
return resolvedPath;
}
|
java
|
public static final Path resolveSecurely(Path rootPath, String path) {
Path resolvedPath;
if(path == null || path.isEmpty()) {
resolvedPath = rootPath.normalize();
} else {
String relativePath = removeSuperflousSlashes(path);
resolvedPath = rootPath.resolve(relativePath).normalize();
}
if(!resolvedPath.startsWith(rootPath)) {
throw DeploymentRepositoryLogger.ROOT_LOGGER.forbiddenPath(path);
}
return resolvedPath;
}
|
[
"public",
"static",
"final",
"Path",
"resolveSecurely",
"(",
"Path",
"rootPath",
",",
"String",
"path",
")",
"{",
"Path",
"resolvedPath",
";",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"resolvedPath",
"=",
"rootPath",
".",
"normalize",
"(",
")",
";",
"}",
"else",
"{",
"String",
"relativePath",
"=",
"removeSuperflousSlashes",
"(",
"path",
")",
";",
"resolvedPath",
"=",
"rootPath",
".",
"resolve",
"(",
"relativePath",
")",
".",
"normalize",
"(",
")",
";",
"}",
"if",
"(",
"!",
"resolvedPath",
".",
"startsWith",
"(",
"rootPath",
")",
")",
"{",
"throw",
"DeploymentRepositoryLogger",
".",
"ROOT_LOGGER",
".",
"forbiddenPath",
"(",
"path",
")",
";",
"}",
"return",
"resolvedPath",
";",
"}"
] |
Resolve a path from the rootPath checking that it doesn't go out of the rootPath.
@param rootPath the starting point for resolution.
@param path the path we want to resolve.
@return the resolved path.
@throws IllegalArgumentException if the resolved path is out of the rootPath or if the resolution failed.
|
[
"Resolve",
"a",
"path",
"from",
"the",
"rootPath",
"checking",
"that",
"it",
"doesn",
"t",
"go",
"out",
"of",
"the",
"rootPath",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L142-L154
|
158,719 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
|
PathUtil.listFiles
|
public static List<ContentRepositoryElement> listFiles(final Path rootPath, Path tempDir, final ContentFilter filter) throws IOException {
List<ContentRepositoryElement> result = new ArrayList<>();
if (Files.exists(rootPath)) {
if(isArchive(rootPath)) {
return listZipContent(rootPath, filter);
}
Files.walkFileTree(rootPath, new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (filter.acceptFile(rootPath, file)) {
result.add(ContentRepositoryElement.createFile(formatPath(rootPath.relativize(file)), Files.size(file)));
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
if (filter.acceptDirectory(rootPath, dir)) {
String directoryPath = formatDirectoryPath(rootPath.relativize(dir));
if(! "/".equals(directoryPath)) {
result.add(ContentRepositoryElement.createFolder(directoryPath));
}
}
return FileVisitResult.CONTINUE;
}
private String formatDirectoryPath(Path path) {
return formatPath(path) + '/';
}
private String formatPath(Path path) {
return path.toString().replace(File.separatorChar, '/');
}
});
} else {
Path file = getFile(rootPath);
if(isArchive(file)) {
Path relativePath = file.relativize(rootPath);
Path target = createTempDirectory(tempDir, "unarchive");
unzip(file, target);
return listFiles(target.resolve(relativePath), tempDir, filter);
} else {
throw new FileNotFoundException(rootPath.toString());
}
}
return result;
}
|
java
|
public static List<ContentRepositoryElement> listFiles(final Path rootPath, Path tempDir, final ContentFilter filter) throws IOException {
List<ContentRepositoryElement> result = new ArrayList<>();
if (Files.exists(rootPath)) {
if(isArchive(rootPath)) {
return listZipContent(rootPath, filter);
}
Files.walkFileTree(rootPath, new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (filter.acceptFile(rootPath, file)) {
result.add(ContentRepositoryElement.createFile(formatPath(rootPath.relativize(file)), Files.size(file)));
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
if (filter.acceptDirectory(rootPath, dir)) {
String directoryPath = formatDirectoryPath(rootPath.relativize(dir));
if(! "/".equals(directoryPath)) {
result.add(ContentRepositoryElement.createFolder(directoryPath));
}
}
return FileVisitResult.CONTINUE;
}
private String formatDirectoryPath(Path path) {
return formatPath(path) + '/';
}
private String formatPath(Path path) {
return path.toString().replace(File.separatorChar, '/');
}
});
} else {
Path file = getFile(rootPath);
if(isArchive(file)) {
Path relativePath = file.relativize(rootPath);
Path target = createTempDirectory(tempDir, "unarchive");
unzip(file, target);
return listFiles(target.resolve(relativePath), tempDir, filter);
} else {
throw new FileNotFoundException(rootPath.toString());
}
}
return result;
}
|
[
"public",
"static",
"List",
"<",
"ContentRepositoryElement",
">",
"listFiles",
"(",
"final",
"Path",
"rootPath",
",",
"Path",
"tempDir",
",",
"final",
"ContentFilter",
"filter",
")",
"throws",
"IOException",
"{",
"List",
"<",
"ContentRepositoryElement",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"Files",
".",
"exists",
"(",
"rootPath",
")",
")",
"{",
"if",
"(",
"isArchive",
"(",
"rootPath",
")",
")",
"{",
"return",
"listZipContent",
"(",
"rootPath",
",",
"filter",
")",
";",
"}",
"Files",
".",
"walkFileTree",
"(",
"rootPath",
",",
"new",
"FileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"preVisitDirectory",
"(",
"Path",
"dir",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"Path",
"file",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"if",
"(",
"filter",
".",
"acceptFile",
"(",
"rootPath",
",",
"file",
")",
")",
"{",
"result",
".",
"add",
"(",
"ContentRepositoryElement",
".",
"createFile",
"(",
"formatPath",
"(",
"rootPath",
".",
"relativize",
"(",
"file",
")",
")",
",",
"Files",
".",
"size",
"(",
"file",
")",
")",
")",
";",
"}",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"visitFileFailed",
"(",
"Path",
"file",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"Path",
"dir",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"filter",
".",
"acceptDirectory",
"(",
"rootPath",
",",
"dir",
")",
")",
"{",
"String",
"directoryPath",
"=",
"formatDirectoryPath",
"(",
"rootPath",
".",
"relativize",
"(",
"dir",
")",
")",
";",
"if",
"(",
"!",
"\"/\"",
".",
"equals",
"(",
"directoryPath",
")",
")",
"{",
"result",
".",
"add",
"(",
"ContentRepositoryElement",
".",
"createFolder",
"(",
"directoryPath",
")",
")",
";",
"}",
"}",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"private",
"String",
"formatDirectoryPath",
"(",
"Path",
"path",
")",
"{",
"return",
"formatPath",
"(",
"path",
")",
"+",
"'",
"'",
";",
"}",
"private",
"String",
"formatPath",
"(",
"Path",
"path",
")",
"{",
"return",
"path",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"File",
".",
"separatorChar",
",",
"'",
"'",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"Path",
"file",
"=",
"getFile",
"(",
"rootPath",
")",
";",
"if",
"(",
"isArchive",
"(",
"file",
")",
")",
"{",
"Path",
"relativePath",
"=",
"file",
".",
"relativize",
"(",
"rootPath",
")",
";",
"Path",
"target",
"=",
"createTempDirectory",
"(",
"tempDir",
",",
"\"unarchive\"",
")",
";",
"unzip",
"(",
"file",
",",
"target",
")",
";",
"return",
"listFiles",
"(",
"target",
".",
"resolve",
"(",
"relativePath",
")",
",",
"tempDir",
",",
"filter",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"rootPath",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
List files in a path according to the specified filter.
@param rootPath the path from which we are listing the files.
@param filter the filter to be applied.
@return the list of files / directory.
@throws IOException
|
[
"List",
"files",
"in",
"a",
"path",
"according",
"to",
"the",
"specified",
"filter",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L204-L260
|
158,720 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
|
PathUtil.createTempDirectory
|
public static Path createTempDirectory(Path dir, String prefix) throws IOException {
try {
return Files.createTempDirectory(dir, prefix);
} catch (UnsupportedOperationException ex) {
}
return Files.createTempDirectory(dir, prefix);
}
|
java
|
public static Path createTempDirectory(Path dir, String prefix) throws IOException {
try {
return Files.createTempDirectory(dir, prefix);
} catch (UnsupportedOperationException ex) {
}
return Files.createTempDirectory(dir, prefix);
}
|
[
"public",
"static",
"Path",
"createTempDirectory",
"(",
"Path",
"dir",
",",
"String",
"prefix",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"Files",
".",
"createTempDirectory",
"(",
"dir",
",",
"prefix",
")",
";",
"}",
"catch",
"(",
"UnsupportedOperationException",
"ex",
")",
"{",
"}",
"return",
"Files",
".",
"createTempDirectory",
"(",
"dir",
",",
"prefix",
")",
";",
"}"
] |
Create a temporary directory with the same attributes as its parent directory.
@param dir
the path to directory in which to create the directory
@param prefix
the prefix string to be used in generating the directory's name;
may be {@code null}
@return the path to the newly created directory that did not exist before
this method was invoked
@throws IOException
|
[
"Create",
"a",
"temporary",
"directory",
"with",
"the",
"same",
"attributes",
"as",
"its",
"parent",
"directory",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L297-L303
|
158,721 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
|
PathUtil.unzip
|
public static void unzip(Path zip, Path target) throws IOException {
try (final ZipFile zipFile = new ZipFile(zip.toFile())){
unzip(zipFile, target);
}
}
|
java
|
public static void unzip(Path zip, Path target) throws IOException {
try (final ZipFile zipFile = new ZipFile(zip.toFile())){
unzip(zipFile, target);
}
}
|
[
"public",
"static",
"void",
"unzip",
"(",
"Path",
"zip",
",",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"ZipFile",
"zipFile",
"=",
"new",
"ZipFile",
"(",
"zip",
".",
"toFile",
"(",
")",
")",
")",
"{",
"unzip",
"(",
"zipFile",
",",
"target",
")",
";",
"}",
"}"
] |
Unzip a file to a target directory.
@param zip the path to the zip file.
@param target the path to the target directory into which the zip file will be unzipped.
@throws IOException
|
[
"Unzip",
"a",
"file",
"to",
"a",
"target",
"directory",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L311-L315
|
158,722 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/services/path/RelativePathService.java
|
RelativePathService.addService
|
public static ServiceController<String> addService(final ServiceName name, final String path,
boolean possiblyAbsolute, final String relativeTo, final ServiceTarget serviceTarget) {
if (possiblyAbsolute && isAbsoluteUnixOrWindowsPath(path)) {
return AbsolutePathService.addService(name, path, serviceTarget);
}
RelativePathService service = new RelativePathService(path);
ServiceBuilder<String> builder = serviceTarget.addService(name, service)
.addDependency(pathNameOf(relativeTo), String.class, service.injectedPath);
ServiceController<String> svc = builder.install();
return svc;
}
|
java
|
public static ServiceController<String> addService(final ServiceName name, final String path,
boolean possiblyAbsolute, final String relativeTo, final ServiceTarget serviceTarget) {
if (possiblyAbsolute && isAbsoluteUnixOrWindowsPath(path)) {
return AbsolutePathService.addService(name, path, serviceTarget);
}
RelativePathService service = new RelativePathService(path);
ServiceBuilder<String> builder = serviceTarget.addService(name, service)
.addDependency(pathNameOf(relativeTo), String.class, service.injectedPath);
ServiceController<String> svc = builder.install();
return svc;
}
|
[
"public",
"static",
"ServiceController",
"<",
"String",
">",
"addService",
"(",
"final",
"ServiceName",
"name",
",",
"final",
"String",
"path",
",",
"boolean",
"possiblyAbsolute",
",",
"final",
"String",
"relativeTo",
",",
"final",
"ServiceTarget",
"serviceTarget",
")",
"{",
"if",
"(",
"possiblyAbsolute",
"&&",
"isAbsoluteUnixOrWindowsPath",
"(",
"path",
")",
")",
"{",
"return",
"AbsolutePathService",
".",
"addService",
"(",
"name",
",",
"path",
",",
"serviceTarget",
")",
";",
"}",
"RelativePathService",
"service",
"=",
"new",
"RelativePathService",
"(",
"path",
")",
";",
"ServiceBuilder",
"<",
"String",
">",
"builder",
"=",
"serviceTarget",
".",
"addService",
"(",
"name",
",",
"service",
")",
".",
"addDependency",
"(",
"pathNameOf",
"(",
"relativeTo",
")",
",",
"String",
".",
"class",
",",
"service",
".",
"injectedPath",
")",
";",
"ServiceController",
"<",
"String",
">",
"svc",
"=",
"builder",
".",
"install",
"(",
")",
";",
"return",
"svc",
";",
"}"
] |
Installs a path service.
@param name the name to use for the service
@param path the relative portion of the path
@param possiblyAbsolute {@code true} if {@code path} may be an {@link #isAbsoluteUnixOrWindowsPath(String) absolute path}
and should be {@link AbsolutePathService installed as such} if it is, with any
{@code relativeTo} parameter ignored
@param relativeTo the name of the path that {@code path} may be relative to
@param serviceTarget the {@link ServiceTarget} to use to install the service
@return the ServiceController for the path service
|
[
"Installs",
"a",
"path",
"service",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/services/path/RelativePathService.java#L72-L84
|
158,723 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/validation/PatchingGarbageLocator.java
|
PatchingGarbageLocator.getInactiveHistory
|
public List<File> getInactiveHistory() throws PatchingException {
if (validHistory == null) {
walk();
}
final File[] inactiveDirs = installedIdentity.getInstalledImage().getPatchesDir().listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory() && !validHistory.contains(pathname.getName());
}
});
return inactiveDirs == null ? Collections.<File>emptyList() : Arrays.asList(inactiveDirs);
}
|
java
|
public List<File> getInactiveHistory() throws PatchingException {
if (validHistory == null) {
walk();
}
final File[] inactiveDirs = installedIdentity.getInstalledImage().getPatchesDir().listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory() && !validHistory.contains(pathname.getName());
}
});
return inactiveDirs == null ? Collections.<File>emptyList() : Arrays.asList(inactiveDirs);
}
|
[
"public",
"List",
"<",
"File",
">",
"getInactiveHistory",
"(",
")",
"throws",
"PatchingException",
"{",
"if",
"(",
"validHistory",
"==",
"null",
")",
"{",
"walk",
"(",
")",
";",
"}",
"final",
"File",
"[",
"]",
"inactiveDirs",
"=",
"installedIdentity",
".",
"getInstalledImage",
"(",
")",
".",
"getPatchesDir",
"(",
")",
".",
"listFiles",
"(",
"new",
"FileFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"pathname",
")",
"{",
"return",
"pathname",
".",
"isDirectory",
"(",
")",
"&&",
"!",
"validHistory",
".",
"contains",
"(",
"pathname",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"inactiveDirs",
"==",
"null",
"?",
"Collections",
".",
"<",
"File",
">",
"emptyList",
"(",
")",
":",
"Arrays",
".",
"asList",
"(",
"inactiveDirs",
")",
";",
"}"
] |
Get the inactive history directories.
@return the inactive history
|
[
"Get",
"the",
"inactive",
"history",
"directories",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/PatchingGarbageLocator.java#L149-L160
|
158,724 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/validation/PatchingGarbageLocator.java
|
PatchingGarbageLocator.getInactiveOverlays
|
public List<File> getInactiveOverlays() throws PatchingException {
if (referencedOverlayDirectories == null) {
walk();
}
List<File> inactiveDirs = null;
for (Layer layer : installedIdentity.getLayers()) {
final File overlaysDir = new File(layer.getDirectoryStructure().getModuleRoot(), Constants.OVERLAYS);
final File[] inactiveLayerDirs = overlaysDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory() && !referencedOverlayDirectories.contains(pathname);
}
});
if (inactiveLayerDirs != null && inactiveLayerDirs.length > 0) {
if (inactiveDirs == null) {
inactiveDirs = new ArrayList<File>();
}
inactiveDirs.addAll(Arrays.asList(inactiveLayerDirs));
}
}
return inactiveDirs == null ? Collections.<File>emptyList() : inactiveDirs;
}
|
java
|
public List<File> getInactiveOverlays() throws PatchingException {
if (referencedOverlayDirectories == null) {
walk();
}
List<File> inactiveDirs = null;
for (Layer layer : installedIdentity.getLayers()) {
final File overlaysDir = new File(layer.getDirectoryStructure().getModuleRoot(), Constants.OVERLAYS);
final File[] inactiveLayerDirs = overlaysDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory() && !referencedOverlayDirectories.contains(pathname);
}
});
if (inactiveLayerDirs != null && inactiveLayerDirs.length > 0) {
if (inactiveDirs == null) {
inactiveDirs = new ArrayList<File>();
}
inactiveDirs.addAll(Arrays.asList(inactiveLayerDirs));
}
}
return inactiveDirs == null ? Collections.<File>emptyList() : inactiveDirs;
}
|
[
"public",
"List",
"<",
"File",
">",
"getInactiveOverlays",
"(",
")",
"throws",
"PatchingException",
"{",
"if",
"(",
"referencedOverlayDirectories",
"==",
"null",
")",
"{",
"walk",
"(",
")",
";",
"}",
"List",
"<",
"File",
">",
"inactiveDirs",
"=",
"null",
";",
"for",
"(",
"Layer",
"layer",
":",
"installedIdentity",
".",
"getLayers",
"(",
")",
")",
"{",
"final",
"File",
"overlaysDir",
"=",
"new",
"File",
"(",
"layer",
".",
"getDirectoryStructure",
"(",
")",
".",
"getModuleRoot",
"(",
")",
",",
"Constants",
".",
"OVERLAYS",
")",
";",
"final",
"File",
"[",
"]",
"inactiveLayerDirs",
"=",
"overlaysDir",
".",
"listFiles",
"(",
"new",
"FileFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"pathname",
")",
"{",
"return",
"pathname",
".",
"isDirectory",
"(",
")",
"&&",
"!",
"referencedOverlayDirectories",
".",
"contains",
"(",
"pathname",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"inactiveLayerDirs",
"!=",
"null",
"&&",
"inactiveLayerDirs",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"inactiveDirs",
"==",
"null",
")",
"{",
"inactiveDirs",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"}",
"inactiveDirs",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"inactiveLayerDirs",
")",
")",
";",
"}",
"}",
"return",
"inactiveDirs",
"==",
"null",
"?",
"Collections",
".",
"<",
"File",
">",
"emptyList",
"(",
")",
":",
"inactiveDirs",
";",
"}"
] |
Get the inactive overlay directories.
@return the inactive overlay directories
|
[
"Get",
"the",
"inactive",
"overlay",
"directories",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/PatchingGarbageLocator.java#L167-L188
|
158,725 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/validation/PatchingGarbageLocator.java
|
PatchingGarbageLocator.deleteInactiveContent
|
public void deleteInactiveContent() throws PatchingException {
List<File> dirs = getInactiveHistory();
if (!dirs.isEmpty()) {
for (File dir : dirs) {
deleteDir(dir, ALL);
}
}
dirs = getInactiveOverlays();
if (!dirs.isEmpty()) {
for (File dir : dirs) {
deleteDir(dir, ALL);
}
}
}
|
java
|
public void deleteInactiveContent() throws PatchingException {
List<File> dirs = getInactiveHistory();
if (!dirs.isEmpty()) {
for (File dir : dirs) {
deleteDir(dir, ALL);
}
}
dirs = getInactiveOverlays();
if (!dirs.isEmpty()) {
for (File dir : dirs) {
deleteDir(dir, ALL);
}
}
}
|
[
"public",
"void",
"deleteInactiveContent",
"(",
")",
"throws",
"PatchingException",
"{",
"List",
"<",
"File",
">",
"dirs",
"=",
"getInactiveHistory",
"(",
")",
";",
"if",
"(",
"!",
"dirs",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"File",
"dir",
":",
"dirs",
")",
"{",
"deleteDir",
"(",
"dir",
",",
"ALL",
")",
";",
"}",
"}",
"dirs",
"=",
"getInactiveOverlays",
"(",
")",
";",
"if",
"(",
"!",
"dirs",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"File",
"dir",
":",
"dirs",
")",
"{",
"deleteDir",
"(",
"dir",
",",
"ALL",
")",
";",
"}",
"}",
"}"
] |
Delete inactive contents.
|
[
"Delete",
"inactive",
"contents",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/PatchingGarbageLocator.java#L193-L206
|
158,726 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/HostControllerBootstrap.java
|
HostControllerBootstrap.bootstrap
|
public void bootstrap() throws Exception {
final HostRunningModeControl runningModeControl = environment.getRunningModeControl();
final ControlledProcessState processState = new ControlledProcessState(true);
shutdownHook.setControlledProcessState(processState);
ServiceTarget target = serviceContainer.subTarget();
ControlledProcessStateService controlledProcessStateService = ControlledProcessStateService.addService(target, processState).getValue();
RunningStateJmx.registerMBean(controlledProcessStateService, null, runningModeControl, false);
final HostControllerService hcs = new HostControllerService(environment, runningModeControl, authCode, processState);
target.addService(HostControllerService.HC_SERVICE_NAME, hcs).install();
}
|
java
|
public void bootstrap() throws Exception {
final HostRunningModeControl runningModeControl = environment.getRunningModeControl();
final ControlledProcessState processState = new ControlledProcessState(true);
shutdownHook.setControlledProcessState(processState);
ServiceTarget target = serviceContainer.subTarget();
ControlledProcessStateService controlledProcessStateService = ControlledProcessStateService.addService(target, processState).getValue();
RunningStateJmx.registerMBean(controlledProcessStateService, null, runningModeControl, false);
final HostControllerService hcs = new HostControllerService(environment, runningModeControl, authCode, processState);
target.addService(HostControllerService.HC_SERVICE_NAME, hcs).install();
}
|
[
"public",
"void",
"bootstrap",
"(",
")",
"throws",
"Exception",
"{",
"final",
"HostRunningModeControl",
"runningModeControl",
"=",
"environment",
".",
"getRunningModeControl",
"(",
")",
";",
"final",
"ControlledProcessState",
"processState",
"=",
"new",
"ControlledProcessState",
"(",
"true",
")",
";",
"shutdownHook",
".",
"setControlledProcessState",
"(",
"processState",
")",
";",
"ServiceTarget",
"target",
"=",
"serviceContainer",
".",
"subTarget",
"(",
")",
";",
"ControlledProcessStateService",
"controlledProcessStateService",
"=",
"ControlledProcessStateService",
".",
"addService",
"(",
"target",
",",
"processState",
")",
".",
"getValue",
"(",
")",
";",
"RunningStateJmx",
".",
"registerMBean",
"(",
"controlledProcessStateService",
",",
"null",
",",
"runningModeControl",
",",
"false",
")",
";",
"final",
"HostControllerService",
"hcs",
"=",
"new",
"HostControllerService",
"(",
"environment",
",",
"runningModeControl",
",",
"authCode",
",",
"processState",
")",
";",
"target",
".",
"addService",
"(",
"HostControllerService",
".",
"HC_SERVICE_NAME",
",",
"hcs",
")",
".",
"install",
"(",
")",
";",
"}"
] |
Start the host controller services.
@throws Exception
|
[
"Start",
"the",
"host",
"controller",
"services",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerBootstrap.java#L60-L69
|
158,727 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PersistentResourceXMLDescription.java
|
PersistentResourceXMLDescription.persistDecorator
|
private void persistDecorator(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException {
if (shouldWriteDecoratorAndElements(model)) {
writer.writeStartElement(decoratorElement);
persistChildren(writer, model);
writer.writeEndElement();
}
}
|
java
|
private void persistDecorator(XMLExtendedStreamWriter writer, ModelNode model) throws XMLStreamException {
if (shouldWriteDecoratorAndElements(model)) {
writer.writeStartElement(decoratorElement);
persistChildren(writer, model);
writer.writeEndElement();
}
}
|
[
"private",
"void",
"persistDecorator",
"(",
"XMLExtendedStreamWriter",
"writer",
",",
"ModelNode",
"model",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"shouldWriteDecoratorAndElements",
"(",
"model",
")",
")",
"{",
"writer",
".",
"writeStartElement",
"(",
"decoratorElement",
")",
";",
"persistChildren",
"(",
"writer",
",",
"model",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}",
"}"
] |
persist decorator and than continue to children without touching the model
|
[
"persist",
"decorator",
"and",
"than",
"continue",
"to",
"children",
"without",
"touching",
"the",
"model"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PersistentResourceXMLDescription.java#L366-L372
|
158,728 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PersistentResourceXMLDescription.java
|
PersistentResourceXMLDescription.decorator
|
@Deprecated
public static PersistentResourceXMLBuilder decorator(final String elementName) {
return new PersistentResourceXMLBuilder(PathElement.pathElement(elementName), null).setDecoratorGroup(elementName);
}
|
java
|
@Deprecated
public static PersistentResourceXMLBuilder decorator(final String elementName) {
return new PersistentResourceXMLBuilder(PathElement.pathElement(elementName), null).setDecoratorGroup(elementName);
}
|
[
"@",
"Deprecated",
"public",
"static",
"PersistentResourceXMLBuilder",
"decorator",
"(",
"final",
"String",
"elementName",
")",
"{",
"return",
"new",
"PersistentResourceXMLBuilder",
"(",
"PathElement",
".",
"pathElement",
"(",
"elementName",
")",
",",
"null",
")",
".",
"setDecoratorGroup",
"(",
"elementName",
")",
";",
"}"
] |
Creates builder for passed path element
@param elementName name of xml element that is used as decorator
@return PersistentResourceXMLBuilder
@deprecated decorator element support is currently considered as preview
@since 4.0
|
[
"Creates",
"builder",
"for",
"passed",
"path",
"element"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PersistentResourceXMLDescription.java#L579-L582
|
158,729 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/description/AttributeTransformationDescription.java
|
AttributeTransformationDescription.rejectAttributes
|
void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) {
for (RejectAttributeChecker checker : checks) {
rejectedAttributes.checkAttribute(checker, name, attributeValue);
}
}
|
java
|
void rejectAttributes(RejectedAttributesLogContext rejectedAttributes, ModelNode attributeValue) {
for (RejectAttributeChecker checker : checks) {
rejectedAttributes.checkAttribute(checker, name, attributeValue);
}
}
|
[
"void",
"rejectAttributes",
"(",
"RejectedAttributesLogContext",
"rejectedAttributes",
",",
"ModelNode",
"attributeValue",
")",
"{",
"for",
"(",
"RejectAttributeChecker",
"checker",
":",
"checks",
")",
"{",
"rejectedAttributes",
".",
"checkAttribute",
"(",
"checker",
",",
"name",
",",
"attributeValue",
")",
";",
"}",
"}"
] |
Checks attributes for rejection
@param rejectedAttributes gathers information about failed attributes
@param attributeValue the attribute value
|
[
"Checks",
"attributes",
"for",
"rejection"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/description/AttributeTransformationDescription.java#L90-L94
|
158,730 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/registry/ConcreteResourceRegistration.java
|
ConcreteResourceRegistration.getInheritableOperationEntryLocked
|
private OperationEntry getInheritableOperationEntryLocked(final String operationName) {
final OperationEntry entry = operations == null ? null : operations.get(operationName);
if (entry != null && entry.isInherited()) {
return entry;
}
return null;
}
|
java
|
private OperationEntry getInheritableOperationEntryLocked(final String operationName) {
final OperationEntry entry = operations == null ? null : operations.get(operationName);
if (entry != null && entry.isInherited()) {
return entry;
}
return null;
}
|
[
"private",
"OperationEntry",
"getInheritableOperationEntryLocked",
"(",
"final",
"String",
"operationName",
")",
"{",
"final",
"OperationEntry",
"entry",
"=",
"operations",
"==",
"null",
"?",
"null",
":",
"operations",
".",
"get",
"(",
"operationName",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
"&&",
"entry",
".",
"isInherited",
"(",
")",
")",
"{",
"return",
"entry",
";",
"}",
"return",
"null",
";",
"}"
] |
Only call with the read lock held
|
[
"Only",
"call",
"with",
"the",
"read",
"lock",
"held"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/ConcreteResourceRegistration.java#L345-L351
|
158,731 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/ignored/IgnoredDomainResourceRoot.java
|
IgnoredDomainResourceRoot.registerChildInternal
|
private void registerChildInternal(IgnoreDomainResourceTypeResource child) {
child.setParent(this);
children.put(child.getName(), child);
}
|
java
|
private void registerChildInternal(IgnoreDomainResourceTypeResource child) {
child.setParent(this);
children.put(child.getName(), child);
}
|
[
"private",
"void",
"registerChildInternal",
"(",
"IgnoreDomainResourceTypeResource",
"child",
")",
"{",
"child",
".",
"setParent",
"(",
"this",
")",
";",
"children",
".",
"put",
"(",
"child",
".",
"getName",
"(",
")",
",",
"child",
")",
";",
"}"
] |
call with lock on 'children' held
|
[
"call",
"with",
"lock",
"on",
"children",
"held"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ignored/IgnoredDomainResourceRoot.java#L218-L221
|
158,732 |
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java
|
FutureManagementChannel.awaitChannel
|
protected Channel awaitChannel() throws IOException {
Channel channel = this.channel;
if(channel != null) {
return channel;
}
synchronized (lock) {
for(;;) {
if(state == State.CLOSED) {
throw ProtocolLogger.ROOT_LOGGER.channelClosed();
}
channel = this.channel;
if(channel != null) {
return channel;
}
if(state == State.CLOSING) {
throw ProtocolLogger.ROOT_LOGGER.channelClosed();
}
try {
lock.wait();
} catch (InterruptedException e) {
throw new IOException(e);
}
}
}
}
|
java
|
protected Channel awaitChannel() throws IOException {
Channel channel = this.channel;
if(channel != null) {
return channel;
}
synchronized (lock) {
for(;;) {
if(state == State.CLOSED) {
throw ProtocolLogger.ROOT_LOGGER.channelClosed();
}
channel = this.channel;
if(channel != null) {
return channel;
}
if(state == State.CLOSING) {
throw ProtocolLogger.ROOT_LOGGER.channelClosed();
}
try {
lock.wait();
} catch (InterruptedException e) {
throw new IOException(e);
}
}
}
}
|
[
"protected",
"Channel",
"awaitChannel",
"(",
")",
"throws",
"IOException",
"{",
"Channel",
"channel",
"=",
"this",
".",
"channel",
";",
"if",
"(",
"channel",
"!=",
"null",
")",
"{",
"return",
"channel",
";",
"}",
"synchronized",
"(",
"lock",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"state",
"==",
"State",
".",
"CLOSED",
")",
"{",
"throw",
"ProtocolLogger",
".",
"ROOT_LOGGER",
".",
"channelClosed",
"(",
")",
";",
"}",
"channel",
"=",
"this",
".",
"channel",
";",
"if",
"(",
"channel",
"!=",
"null",
")",
"{",
"return",
"channel",
";",
"}",
"if",
"(",
"state",
"==",
"State",
".",
"CLOSING",
")",
"{",
"throw",
"ProtocolLogger",
".",
"ROOT_LOGGER",
".",
"channelClosed",
"(",
")",
";",
"}",
"try",
"{",
"lock",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}"
] |
Get the underlying channel. This may block until the channel is set.
@return the channel
@throws IOException for any error
|
[
"Get",
"the",
"underlying",
"channel",
".",
"This",
"may",
"block",
"until",
"the",
"channel",
"is",
"set",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java#L99-L123
|
158,733 |
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java
|
FutureManagementChannel.prepareClose
|
protected boolean prepareClose() {
synchronized (lock) {
final State state = this.state;
if (state == State.OPEN) {
this.state = State.CLOSING;
lock.notifyAll();
return true;
}
}
return false;
}
|
java
|
protected boolean prepareClose() {
synchronized (lock) {
final State state = this.state;
if (state == State.OPEN) {
this.state = State.CLOSING;
lock.notifyAll();
return true;
}
}
return false;
}
|
[
"protected",
"boolean",
"prepareClose",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"final",
"State",
"state",
"=",
"this",
".",
"state",
";",
"if",
"(",
"state",
"==",
"State",
".",
"OPEN",
")",
"{",
"this",
".",
"state",
"=",
"State",
".",
"CLOSING",
";",
"lock",
".",
"notifyAll",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Signal that we are about to close the channel. This will not have any affect on the underlying channel, however
prevent setting a new channel.
@return whether the closing state was set successfully
|
[
"Signal",
"that",
"we",
"are",
"about",
"to",
"close",
"the",
"channel",
".",
"This",
"will",
"not",
"have",
"any",
"affect",
"on",
"the",
"underlying",
"channel",
"however",
"prevent",
"setting",
"a",
"new",
"channel",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java#L131-L141
|
158,734 |
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java
|
FutureManagementChannel.setChannel
|
protected boolean setChannel(final Channel newChannel) {
if(newChannel == null) {
return false;
}
synchronized (lock) {
if(state != State.OPEN || channel != null) {
return false;
}
this.channel = newChannel;
this.channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(final Channel closed, final IOException exception) {
synchronized (lock) {
if(FutureManagementChannel.this.channel == closed) {
FutureManagementChannel.this.channel = null;
}
lock.notifyAll();
}
}
});
lock.notifyAll();
return true;
}
}
|
java
|
protected boolean setChannel(final Channel newChannel) {
if(newChannel == null) {
return false;
}
synchronized (lock) {
if(state != State.OPEN || channel != null) {
return false;
}
this.channel = newChannel;
this.channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(final Channel closed, final IOException exception) {
synchronized (lock) {
if(FutureManagementChannel.this.channel == closed) {
FutureManagementChannel.this.channel = null;
}
lock.notifyAll();
}
}
});
lock.notifyAll();
return true;
}
}
|
[
"protected",
"boolean",
"setChannel",
"(",
"final",
"Channel",
"newChannel",
")",
"{",
"if",
"(",
"newChannel",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"state",
"!=",
"State",
".",
"OPEN",
"||",
"channel",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"this",
".",
"channel",
"=",
"newChannel",
";",
"this",
".",
"channel",
".",
"addCloseHandler",
"(",
"new",
"CloseHandler",
"<",
"Channel",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"handleClose",
"(",
"final",
"Channel",
"closed",
",",
"final",
"IOException",
"exception",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"FutureManagementChannel",
".",
"this",
".",
"channel",
"==",
"closed",
")",
"{",
"FutureManagementChannel",
".",
"this",
".",
"channel",
"=",
"null",
";",
"}",
"lock",
".",
"notifyAll",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"lock",
".",
"notifyAll",
"(",
")",
";",
"return",
"true",
";",
"}",
"}"
] |
Set the channel. This will return whether the channel could be set successfully or not.
@param newChannel the channel
@return whether the operation succeeded or not
|
[
"Set",
"the",
"channel",
".",
"This",
"will",
"return",
"whether",
"the",
"channel",
"could",
"be",
"set",
"successfully",
"or",
"not",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java#L186-L209
|
158,735 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/operations/DomainDeploymentOverlayRedeployLinksHandler.java
|
DomainDeploymentOverlayRedeployLinksHandler.isRedeployAfterRemoval
|
private boolean isRedeployAfterRemoval(ModelNode operation) {
return operation.hasDefined(DEPLOYMENT_OVERLAY_LINK_REMOVAL) &&
operation.get(DEPLOYMENT_OVERLAY_LINK_REMOVAL).asBoolean();
}
|
java
|
private boolean isRedeployAfterRemoval(ModelNode operation) {
return operation.hasDefined(DEPLOYMENT_OVERLAY_LINK_REMOVAL) &&
operation.get(DEPLOYMENT_OVERLAY_LINK_REMOVAL).asBoolean();
}
|
[
"private",
"boolean",
"isRedeployAfterRemoval",
"(",
"ModelNode",
"operation",
")",
"{",
"return",
"operation",
".",
"hasDefined",
"(",
"DEPLOYMENT_OVERLAY_LINK_REMOVAL",
")",
"&&",
"operation",
".",
"get",
"(",
"DEPLOYMENT_OVERLAY_LINK_REMOVAL",
")",
".",
"asBoolean",
"(",
")",
";",
"}"
] |
Check if this is a redeployment triggered after the removal of a link.
@param operation the current operation.
@return true if this is a redeploy after the removal of a link.
@see org.jboss.as.server.deploymentoverlay.DeploymentOverlayDeploymentRemoveHandler
|
[
"Check",
"if",
"this",
"is",
"a",
"redeployment",
"triggered",
"after",
"the",
"removal",
"of",
"a",
"link",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/DomainDeploymentOverlayRedeployLinksHandler.java#L95-L98
|
158,736 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/audit/AbstractFileAuditLogHandler.java
|
AbstractFileAuditLogHandler.createNewFile
|
protected void createNewFile(final File file) {
try {
file.createNewFile();
setFileNotWorldReadablePermissions(file);
} catch (IOException e){
throw new RuntimeException(e);
}
}
|
java
|
protected void createNewFile(final File file) {
try {
file.createNewFile();
setFileNotWorldReadablePermissions(file);
} catch (IOException e){
throw new RuntimeException(e);
}
}
|
[
"protected",
"void",
"createNewFile",
"(",
"final",
"File",
"file",
")",
"{",
"try",
"{",
"file",
".",
"createNewFile",
"(",
")",
";",
"setFileNotWorldReadablePermissions",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
This creates a new audit log file with default permissions.
@param file File to create
|
[
"This",
"creates",
"a",
"new",
"audit",
"log",
"file",
"with",
"default",
"permissions",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/audit/AbstractFileAuditLogHandler.java#L174-L181
|
158,737 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/audit/AbstractFileAuditLogHandler.java
|
AbstractFileAuditLogHandler.setFileNotWorldReadablePermissions
|
private void setFileNotWorldReadablePermissions(File file) {
file.setReadable(false, false);
file.setWritable(false, false);
file.setExecutable(false, false);
file.setReadable(true, true);
file.setWritable(true, true);
}
|
java
|
private void setFileNotWorldReadablePermissions(File file) {
file.setReadable(false, false);
file.setWritable(false, false);
file.setExecutable(false, false);
file.setReadable(true, true);
file.setWritable(true, true);
}
|
[
"private",
"void",
"setFileNotWorldReadablePermissions",
"(",
"File",
"file",
")",
"{",
"file",
".",
"setReadable",
"(",
"false",
",",
"false",
")",
";",
"file",
".",
"setWritable",
"(",
"false",
",",
"false",
")",
";",
"file",
".",
"setExecutable",
"(",
"false",
",",
"false",
")",
";",
"file",
".",
"setReadable",
"(",
"true",
",",
"true",
")",
";",
"file",
".",
"setWritable",
"(",
"true",
",",
"true",
")",
";",
"}"
] |
This procedure sets permissions to the given file to not allow everybody to read it.
Only when underlying OS allows the change.
@param file File to set permissions
|
[
"This",
"procedure",
"sets",
"permissions",
"to",
"the",
"given",
"file",
"to",
"not",
"allow",
"everybody",
"to",
"read",
"it",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/audit/AbstractFileAuditLogHandler.java#L190-L196
|
158,738 |
wildfly/wildfly-core
|
server/src/main/java/org/jboss/as/server/deployment/integration/Seam2Processor.java
|
Seam2Processor.getSeamIntResourceRoot
|
protected synchronized ResourceRoot getSeamIntResourceRoot() throws DeploymentUnitProcessingException {
try {
if (seamIntResourceRoot == null) {
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
Module extModule = moduleLoader.loadModule(EXT_CONTENT_MODULE);
URL url = extModule.getExportedResource(SEAM_INT_JAR);
if (url == null)
throw ServerLogger.ROOT_LOGGER.noSeamIntegrationJarPresent(extModule);
File file = new File(url.toURI());
VirtualFile vf = VFS.getChild(file.toURI());
final Closeable mountHandle = VFS.mountZip(file, vf, TempFileProviderService.provider());
Service<Closeable> mountHandleService = new Service<Closeable>() {
public void start(StartContext startContext) throws StartException {
}
public void stop(StopContext stopContext) {
VFSUtils.safeClose(mountHandle);
}
public Closeable getValue() throws IllegalStateException, IllegalArgumentException {
return mountHandle;
}
};
ServiceBuilder<Closeable> builder = serviceTarget.addService(ServiceName.JBOSS.append(SEAM_INT_JAR),
mountHandleService);
builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
serviceTarget = null; // our cleanup service install work is done
MountHandle dummy = MountHandle.create(null); // actual close is done by the MSC service above
seamIntResourceRoot = new ResourceRoot(vf, dummy);
}
return seamIntResourceRoot;
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
}
|
java
|
protected synchronized ResourceRoot getSeamIntResourceRoot() throws DeploymentUnitProcessingException {
try {
if (seamIntResourceRoot == null) {
final ModuleLoader moduleLoader = Module.getBootModuleLoader();
Module extModule = moduleLoader.loadModule(EXT_CONTENT_MODULE);
URL url = extModule.getExportedResource(SEAM_INT_JAR);
if (url == null)
throw ServerLogger.ROOT_LOGGER.noSeamIntegrationJarPresent(extModule);
File file = new File(url.toURI());
VirtualFile vf = VFS.getChild(file.toURI());
final Closeable mountHandle = VFS.mountZip(file, vf, TempFileProviderService.provider());
Service<Closeable> mountHandleService = new Service<Closeable>() {
public void start(StartContext startContext) throws StartException {
}
public void stop(StopContext stopContext) {
VFSUtils.safeClose(mountHandle);
}
public Closeable getValue() throws IllegalStateException, IllegalArgumentException {
return mountHandle;
}
};
ServiceBuilder<Closeable> builder = serviceTarget.addService(ServiceName.JBOSS.append(SEAM_INT_JAR),
mountHandleService);
builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
serviceTarget = null; // our cleanup service install work is done
MountHandle dummy = MountHandle.create(null); // actual close is done by the MSC service above
seamIntResourceRoot = new ResourceRoot(vf, dummy);
}
return seamIntResourceRoot;
} catch (Exception e) {
throw new DeploymentUnitProcessingException(e);
}
}
|
[
"protected",
"synchronized",
"ResourceRoot",
"getSeamIntResourceRoot",
"(",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"try",
"{",
"if",
"(",
"seamIntResourceRoot",
"==",
"null",
")",
"{",
"final",
"ModuleLoader",
"moduleLoader",
"=",
"Module",
".",
"getBootModuleLoader",
"(",
")",
";",
"Module",
"extModule",
"=",
"moduleLoader",
".",
"loadModule",
"(",
"EXT_CONTENT_MODULE",
")",
";",
"URL",
"url",
"=",
"extModule",
".",
"getExportedResource",
"(",
"SEAM_INT_JAR",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"throw",
"ServerLogger",
".",
"ROOT_LOGGER",
".",
"noSeamIntegrationJarPresent",
"(",
"extModule",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"url",
".",
"toURI",
"(",
")",
")",
";",
"VirtualFile",
"vf",
"=",
"VFS",
".",
"getChild",
"(",
"file",
".",
"toURI",
"(",
")",
")",
";",
"final",
"Closeable",
"mountHandle",
"=",
"VFS",
".",
"mountZip",
"(",
"file",
",",
"vf",
",",
"TempFileProviderService",
".",
"provider",
"(",
")",
")",
";",
"Service",
"<",
"Closeable",
">",
"mountHandleService",
"=",
"new",
"Service",
"<",
"Closeable",
">",
"(",
")",
"{",
"public",
"void",
"start",
"(",
"StartContext",
"startContext",
")",
"throws",
"StartException",
"{",
"}",
"public",
"void",
"stop",
"(",
"StopContext",
"stopContext",
")",
"{",
"VFSUtils",
".",
"safeClose",
"(",
"mountHandle",
")",
";",
"}",
"public",
"Closeable",
"getValue",
"(",
")",
"throws",
"IllegalStateException",
",",
"IllegalArgumentException",
"{",
"return",
"mountHandle",
";",
"}",
"}",
";",
"ServiceBuilder",
"<",
"Closeable",
">",
"builder",
"=",
"serviceTarget",
".",
"addService",
"(",
"ServiceName",
".",
"JBOSS",
".",
"append",
"(",
"SEAM_INT_JAR",
")",
",",
"mountHandleService",
")",
";",
"builder",
".",
"setInitialMode",
"(",
"ServiceController",
".",
"Mode",
".",
"ACTIVE",
")",
".",
"install",
"(",
")",
";",
"serviceTarget",
"=",
"null",
";",
"// our cleanup service install work is done",
"MountHandle",
"dummy",
"=",
"MountHandle",
".",
"create",
"(",
"null",
")",
";",
"// actual close is done by the MSC service above",
"seamIntResourceRoot",
"=",
"new",
"ResourceRoot",
"(",
"vf",
",",
"dummy",
")",
";",
"}",
"return",
"seamIntResourceRoot",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DeploymentUnitProcessingException",
"(",
"e",
")",
";",
"}",
"}"
] |
Lookup Seam integration resource loader.
@return the Seam integration resource loader
@throws DeploymentUnitProcessingException for any error
|
[
"Lookup",
"Seam",
"integration",
"resource",
"loader",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/integration/Seam2Processor.java#L93-L129
|
158,739 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.pathAddress
|
public static PathAddress pathAddress(final ModelNode node) {
if (node.isDefined()) {
// final List<Property> props = node.asPropertyList();
// Following bit is crap TODO; uncomment above and delete below
// when bug is fixed
final List<Property> props = new ArrayList<Property>();
String key = null;
for (ModelNode element : node.asList()) {
Property prop = null;
if (element.getType() == ModelType.PROPERTY || element.getType() == ModelType.OBJECT) {
prop = element.asProperty();
} else if (key == null) {
key = element.asString();
} else {
prop = new Property(key, element);
}
if (prop != null) {
props.add(prop);
key = null;
}
}
if (props.size() == 0) {
return EMPTY_ADDRESS;
} else {
final Set<String> seen = new HashSet<String>();
final List<PathElement> values = new ArrayList<PathElement>();
int index = 0;
for (final Property prop : props) {
final String name = prop.getName();
if (seen.add(name)) {
values.add(new PathElement(name, prop.getValue().asString()));
} else {
throw duplicateElement(name);
}
if (index == 1 && name.equals(SERVER) && seen.contains(HOST)) {
seen.clear();
}
index++;
}
return new PathAddress(Collections.unmodifiableList(values));
}
} else {
return EMPTY_ADDRESS;
}
}
|
java
|
public static PathAddress pathAddress(final ModelNode node) {
if (node.isDefined()) {
// final List<Property> props = node.asPropertyList();
// Following bit is crap TODO; uncomment above and delete below
// when bug is fixed
final List<Property> props = new ArrayList<Property>();
String key = null;
for (ModelNode element : node.asList()) {
Property prop = null;
if (element.getType() == ModelType.PROPERTY || element.getType() == ModelType.OBJECT) {
prop = element.asProperty();
} else if (key == null) {
key = element.asString();
} else {
prop = new Property(key, element);
}
if (prop != null) {
props.add(prop);
key = null;
}
}
if (props.size() == 0) {
return EMPTY_ADDRESS;
} else {
final Set<String> seen = new HashSet<String>();
final List<PathElement> values = new ArrayList<PathElement>();
int index = 0;
for (final Property prop : props) {
final String name = prop.getName();
if (seen.add(name)) {
values.add(new PathElement(name, prop.getValue().asString()));
} else {
throw duplicateElement(name);
}
if (index == 1 && name.equals(SERVER) && seen.contains(HOST)) {
seen.clear();
}
index++;
}
return new PathAddress(Collections.unmodifiableList(values));
}
} else {
return EMPTY_ADDRESS;
}
}
|
[
"public",
"static",
"PathAddress",
"pathAddress",
"(",
"final",
"ModelNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"isDefined",
"(",
")",
")",
"{",
"// final List<Property> props = node.asPropertyList();",
"// Following bit is crap TODO; uncomment above and delete below",
"// when bug is fixed",
"final",
"List",
"<",
"Property",
">",
"props",
"=",
"new",
"ArrayList",
"<",
"Property",
">",
"(",
")",
";",
"String",
"key",
"=",
"null",
";",
"for",
"(",
"ModelNode",
"element",
":",
"node",
".",
"asList",
"(",
")",
")",
"{",
"Property",
"prop",
"=",
"null",
";",
"if",
"(",
"element",
".",
"getType",
"(",
")",
"==",
"ModelType",
".",
"PROPERTY",
"||",
"element",
".",
"getType",
"(",
")",
"==",
"ModelType",
".",
"OBJECT",
")",
"{",
"prop",
"=",
"element",
".",
"asProperty",
"(",
")",
";",
"}",
"else",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"key",
"=",
"element",
".",
"asString",
"(",
")",
";",
"}",
"else",
"{",
"prop",
"=",
"new",
"Property",
"(",
"key",
",",
"element",
")",
";",
"}",
"if",
"(",
"prop",
"!=",
"null",
")",
"{",
"props",
".",
"add",
"(",
"prop",
")",
";",
"key",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"props",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"EMPTY_ADDRESS",
";",
"}",
"else",
"{",
"final",
"Set",
"<",
"String",
">",
"seen",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"final",
"List",
"<",
"PathElement",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"PathElement",
">",
"(",
")",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"final",
"Property",
"prop",
":",
"props",
")",
"{",
"final",
"String",
"name",
"=",
"prop",
".",
"getName",
"(",
")",
";",
"if",
"(",
"seen",
".",
"add",
"(",
"name",
")",
")",
"{",
"values",
".",
"add",
"(",
"new",
"PathElement",
"(",
"name",
",",
"prop",
".",
"getValue",
"(",
")",
".",
"asString",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"throw",
"duplicateElement",
"(",
"name",
")",
";",
"}",
"if",
"(",
"index",
"==",
"1",
"&&",
"name",
".",
"equals",
"(",
"SERVER",
")",
"&&",
"seen",
".",
"contains",
"(",
"HOST",
")",
")",
"{",
"seen",
".",
"clear",
"(",
")",
";",
"}",
"index",
"++",
";",
"}",
"return",
"new",
"PathAddress",
"(",
"Collections",
".",
"unmodifiableList",
"(",
"values",
")",
")",
";",
"}",
"}",
"else",
"{",
"return",
"EMPTY_ADDRESS",
";",
"}",
"}"
] |
Creates a PathAddress from the given ModelNode address. The given node is expected to be an address node.
@param node the node (cannot be {@code null})
@return the update identifier
|
[
"Creates",
"a",
"PathAddress",
"from",
"the",
"given",
"ModelNode",
"address",
".",
"The",
"given",
"node",
"is",
"expected",
"to",
"be",
"an",
"address",
"node",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L64-L110
|
158,740 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.getElement
|
public PathElement getElement(int index) {
final List<PathElement> list = pathAddressList;
return list.get(index);
}
|
java
|
public PathElement getElement(int index) {
final List<PathElement> list = pathAddressList;
return list.get(index);
}
|
[
"public",
"PathElement",
"getElement",
"(",
"int",
"index",
")",
"{",
"final",
"List",
"<",
"PathElement",
">",
"list",
"=",
"pathAddressList",
";",
"return",
"list",
".",
"get",
"(",
"index",
")",
";",
"}"
] |
Gets the element at the given index.
@param index the index
@return the element
@throws IndexOutOfBoundsException if the index is out of range (<tt>index < 0 || index >= size()</tt>)
|
[
"Gets",
"the",
"element",
"at",
"the",
"given",
"index",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L232-L235
|
158,741 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.getLastElement
|
public PathElement getLastElement() {
final List<PathElement> list = pathAddressList;
return list.size() == 0 ? null : list.get(list.size() - 1);
}
|
java
|
public PathElement getLastElement() {
final List<PathElement> list = pathAddressList;
return list.size() == 0 ? null : list.get(list.size() - 1);
}
|
[
"public",
"PathElement",
"getLastElement",
"(",
")",
"{",
"final",
"List",
"<",
"PathElement",
">",
"list",
"=",
"pathAddressList",
";",
"return",
"list",
".",
"size",
"(",
")",
"==",
"0",
"?",
"null",
":",
"list",
".",
"get",
"(",
"list",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}"
] |
Gets the last element in the address.
@return the element, or {@code null} if {@link #size()} is zero.
|
[
"Gets",
"the",
"last",
"element",
"in",
"the",
"address",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L242-L245
|
158,742 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.append
|
public PathAddress append(List<PathElement> additionalElements) {
final ArrayList<PathElement> newList = new ArrayList<PathElement>(pathAddressList.size() + additionalElements.size());
newList.addAll(pathAddressList);
newList.addAll(additionalElements);
return pathAddress(newList);
}
|
java
|
public PathAddress append(List<PathElement> additionalElements) {
final ArrayList<PathElement> newList = new ArrayList<PathElement>(pathAddressList.size() + additionalElements.size());
newList.addAll(pathAddressList);
newList.addAll(additionalElements);
return pathAddress(newList);
}
|
[
"public",
"PathAddress",
"append",
"(",
"List",
"<",
"PathElement",
">",
"additionalElements",
")",
"{",
"final",
"ArrayList",
"<",
"PathElement",
">",
"newList",
"=",
"new",
"ArrayList",
"<",
"PathElement",
">",
"(",
"pathAddressList",
".",
"size",
"(",
")",
"+",
"additionalElements",
".",
"size",
"(",
")",
")",
";",
"newList",
".",
"addAll",
"(",
"pathAddressList",
")",
";",
"newList",
".",
"addAll",
"(",
"additionalElements",
")",
";",
"return",
"pathAddress",
"(",
"newList",
")",
";",
"}"
] |
Create a new path address by appending more elements to the end of this address.
@param additionalElements the elements to append
@return the new path address
|
[
"Create",
"a",
"new",
"path",
"address",
"by",
"appending",
"more",
"elements",
"to",
"the",
"end",
"of",
"this",
"address",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L275-L280
|
158,743 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.navigate
|
@Deprecated
public ModelNode navigate(ModelNode model, boolean create) throws NoSuchElementException {
final Iterator<PathElement> i = pathAddressList.iterator();
while (i.hasNext()) {
final PathElement element = i.next();
if (create && !i.hasNext()) {
if (element.isMultiTarget()) {
throw new IllegalStateException();
}
model = model.require(element.getKey()).get(element.getValue());
} else {
model = model.require(element.getKey()).require(element.getValue());
}
}
return model;
}
|
java
|
@Deprecated
public ModelNode navigate(ModelNode model, boolean create) throws NoSuchElementException {
final Iterator<PathElement> i = pathAddressList.iterator();
while (i.hasNext()) {
final PathElement element = i.next();
if (create && !i.hasNext()) {
if (element.isMultiTarget()) {
throw new IllegalStateException();
}
model = model.require(element.getKey()).get(element.getValue());
} else {
model = model.require(element.getKey()).require(element.getValue());
}
}
return model;
}
|
[
"@",
"Deprecated",
"public",
"ModelNode",
"navigate",
"(",
"ModelNode",
"model",
",",
"boolean",
"create",
")",
"throws",
"NoSuchElementException",
"{",
"final",
"Iterator",
"<",
"PathElement",
">",
"i",
"=",
"pathAddressList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"PathElement",
"element",
"=",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"create",
"&&",
"!",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"element",
".",
"isMultiTarget",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"model",
"=",
"model",
".",
"require",
"(",
"element",
".",
"getKey",
"(",
")",
")",
".",
"get",
"(",
"element",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"model",
"=",
"model",
".",
"require",
"(",
"element",
".",
"getKey",
"(",
")",
")",
".",
"require",
"(",
"element",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"model",
";",
"}"
] |
Navigate to this address in the given model node.
@param model the model node
@param create {@code true} to create the last part of the node if it does not exist
@return the submodel
@throws NoSuchElementException if the model contains no such element
@deprecated manipulating a deep DMR node tree via PathAddress is no longer how the management layer works
internally, so this method has become legacy cruft. Management operation handlers
should obtain a {@link org.jboss.as.controller.registry.Resource Resource} from the
{@link org.jboss.as.controller.OperationContext#readResource(PathAddress) OperationContext}
and use the {@code Resource} API to access child resources
|
[
"Navigate",
"to",
"this",
"address",
"in",
"the",
"given",
"model",
"node",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L324-L339
|
158,744 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.remove
|
@Deprecated
public ModelNode remove(ModelNode model) throws NoSuchElementException {
final Iterator<PathElement> i = pathAddressList.iterator();
while (i.hasNext()) {
final PathElement element = i.next();
if (i.hasNext()) {
model = model.require(element.getKey()).require(element.getValue());
} else {
final ModelNode parent = model.require(element.getKey());
model = parent.remove(element.getValue()).clone();
}
}
return model;
}
|
java
|
@Deprecated
public ModelNode remove(ModelNode model) throws NoSuchElementException {
final Iterator<PathElement> i = pathAddressList.iterator();
while (i.hasNext()) {
final PathElement element = i.next();
if (i.hasNext()) {
model = model.require(element.getKey()).require(element.getValue());
} else {
final ModelNode parent = model.require(element.getKey());
model = parent.remove(element.getValue()).clone();
}
}
return model;
}
|
[
"@",
"Deprecated",
"public",
"ModelNode",
"remove",
"(",
"ModelNode",
"model",
")",
"throws",
"NoSuchElementException",
"{",
"final",
"Iterator",
"<",
"PathElement",
">",
"i",
"=",
"pathAddressList",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"PathElement",
"element",
"=",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"model",
"=",
"model",
".",
"require",
"(",
"element",
".",
"getKey",
"(",
")",
")",
".",
"require",
"(",
"element",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"final",
"ModelNode",
"parent",
"=",
"model",
".",
"require",
"(",
"element",
".",
"getKey",
"(",
")",
")",
";",
"model",
"=",
"parent",
".",
"remove",
"(",
"element",
".",
"getValue",
"(",
")",
")",
".",
"clone",
"(",
")",
";",
"}",
"}",
"return",
"model",
";",
"}"
] |
Navigate to, and remove, this address in the given model node.
@param model the model node
@return the submodel
@throws NoSuchElementException if the model contains no such element
@deprecated manipulating a deep DMR node tree via PathAddress is no longer how the management layer works
internally, so this method has become legacy cruft. Management operation handlers would
use {@link org.jboss.as.controller.OperationContext#removeResource(PathAddress)} to
remove resources.
|
[
"Navigate",
"to",
"and",
"remove",
"this",
"address",
"in",
"the",
"given",
"model",
"node",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L353-L366
|
158,745 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.toModelNode
|
public ModelNode toModelNode() {
final ModelNode node = new ModelNode().setEmptyList();
for (PathElement element : pathAddressList) {
final String value;
if (element.isMultiTarget() && !element.isWildcard()) {
value = '[' + element.getValue() + ']';
} else {
value = element.getValue();
}
node.add(element.getKey(), value);
}
return node;
}
|
java
|
public ModelNode toModelNode() {
final ModelNode node = new ModelNode().setEmptyList();
for (PathElement element : pathAddressList) {
final String value;
if (element.isMultiTarget() && !element.isWildcard()) {
value = '[' + element.getValue() + ']';
} else {
value = element.getValue();
}
node.add(element.getKey(), value);
}
return node;
}
|
[
"public",
"ModelNode",
"toModelNode",
"(",
")",
"{",
"final",
"ModelNode",
"node",
"=",
"new",
"ModelNode",
"(",
")",
".",
"setEmptyList",
"(",
")",
";",
"for",
"(",
"PathElement",
"element",
":",
"pathAddressList",
")",
"{",
"final",
"String",
"value",
";",
"if",
"(",
"element",
".",
"isMultiTarget",
"(",
")",
"&&",
"!",
"element",
".",
"isWildcard",
"(",
")",
")",
"{",
"value",
"=",
"'",
"'",
"+",
"element",
".",
"getValue",
"(",
")",
"+",
"'",
"'",
";",
"}",
"else",
"{",
"value",
"=",
"element",
".",
"getValue",
"(",
")",
";",
"}",
"node",
".",
"add",
"(",
"element",
".",
"getKey",
"(",
")",
",",
"value",
")",
";",
"}",
"return",
"node",
";",
"}"
] |
Convert this path address to its model node representation.
@return the model node list of properties
|
[
"Convert",
"this",
"path",
"address",
"to",
"its",
"model",
"node",
"representation",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L373-L385
|
158,746 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/PathAddress.java
|
PathAddress.matches
|
public boolean matches(PathAddress address) {
if (address == null) {
return false;
}
if (equals(address)) {
return true;
}
if (size() != address.size()) {
return false;
}
for (int i = 0; i < size(); i++) {
PathElement pe = getElement(i);
PathElement other = address.getElement(i);
if (!pe.matches(other)) {
// Could be a multiTarget with segments
if (pe.isMultiTarget() && !pe.isWildcard()) {
boolean matched = false;
for (String segment : pe.getSegments()) {
if (segment.equals(other.getValue())) {
matched = true;
break;
}
}
if (!matched) {
return false;
}
} else {
return false;
}
}
}
return true;
}
|
java
|
public boolean matches(PathAddress address) {
if (address == null) {
return false;
}
if (equals(address)) {
return true;
}
if (size() != address.size()) {
return false;
}
for (int i = 0; i < size(); i++) {
PathElement pe = getElement(i);
PathElement other = address.getElement(i);
if (!pe.matches(other)) {
// Could be a multiTarget with segments
if (pe.isMultiTarget() && !pe.isWildcard()) {
boolean matched = false;
for (String segment : pe.getSegments()) {
if (segment.equals(other.getValue())) {
matched = true;
break;
}
}
if (!matched) {
return false;
}
} else {
return false;
}
}
}
return true;
}
|
[
"public",
"boolean",
"matches",
"(",
"PathAddress",
"address",
")",
"{",
"if",
"(",
"address",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"equals",
"(",
"address",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"size",
"(",
")",
"!=",
"address",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"PathElement",
"pe",
"=",
"getElement",
"(",
"i",
")",
";",
"PathElement",
"other",
"=",
"address",
".",
"getElement",
"(",
"i",
")",
";",
"if",
"(",
"!",
"pe",
".",
"matches",
"(",
"other",
")",
")",
"{",
"// Could be a multiTarget with segments",
"if",
"(",
"pe",
".",
"isMultiTarget",
"(",
")",
"&&",
"!",
"pe",
".",
"isWildcard",
"(",
")",
")",
"{",
"boolean",
"matched",
"=",
"false",
";",
"for",
"(",
"String",
"segment",
":",
"pe",
".",
"getSegments",
"(",
")",
")",
"{",
"if",
"(",
"segment",
".",
"equals",
"(",
"other",
".",
"getValue",
"(",
")",
")",
")",
"{",
"matched",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"matched",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if this path matches the address path.
An address matches this address if its path elements match or are valid
multi targets for this path elements. Addresses that are equal are matching.
@param address The path to check against this path. If null, this method
returns false.
@return true if the provided path matches, false otherwise.
|
[
"Check",
"if",
"this",
"path",
"matches",
"the",
"address",
"path",
".",
"An",
"address",
"matches",
"this",
"address",
"if",
"its",
"path",
"elements",
"match",
"or",
"are",
"valid",
"multi",
"targets",
"for",
"this",
"path",
"elements",
".",
"Addresses",
"that",
"are",
"equal",
"are",
"matching",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L476-L508
|
158,747 |
wildfly/wildfly-core
|
server/src/main/java/org/jboss/as/server/deployment/annotation/ResourceRootIndexer.java
|
ResourceRootIndexer.indexResourceRoot
|
public static void indexResourceRoot(final ResourceRoot resourceRoot) throws DeploymentUnitProcessingException {
if (resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX) != null) {
return;
}
VirtualFile indexFile = resourceRoot.getRoot().getChild(ModuleIndexBuilder.INDEX_LOCATION);
if (indexFile.exists()) {
try {
IndexReader reader = new IndexReader(indexFile.openStream());
resourceRoot.putAttachment(Attachments.ANNOTATION_INDEX, reader.read());
ServerLogger.DEPLOYMENT_LOGGER.tracef("Found and read index at: %s", indexFile);
return;
} catch (Exception e) {
ServerLogger.DEPLOYMENT_LOGGER.cannotLoadAnnotationIndex(indexFile.getPathName());
}
}
// if this flag is present and set to false then do not index the resource
Boolean shouldIndexResource = resourceRoot.getAttachment(Attachments.INDEX_RESOURCE_ROOT);
if (shouldIndexResource != null && !shouldIndexResource) {
return;
}
final List<String> indexIgnorePathList = resourceRoot.getAttachment(Attachments.INDEX_IGNORE_PATHS);
final Set<String> indexIgnorePaths;
if (indexIgnorePathList != null && !indexIgnorePathList.isEmpty()) {
indexIgnorePaths = new HashSet<String>(indexIgnorePathList);
} else {
indexIgnorePaths = null;
}
final VirtualFile virtualFile = resourceRoot.getRoot();
final Indexer indexer = new Indexer();
try {
final VisitorAttributes visitorAttributes = new VisitorAttributes();
visitorAttributes.setLeavesOnly(true);
visitorAttributes.setRecurseFilter(new VirtualFileFilter() {
public boolean accepts(VirtualFile file) {
return indexIgnorePaths == null || !indexIgnorePaths.contains(file.getPathNameRelativeTo(virtualFile));
}
});
final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class", visitorAttributes));
for (VirtualFile classFile : classChildren) {
InputStream inputStream = null;
try {
inputStream = classFile.openStream();
indexer.index(inputStream);
} catch (Exception e) {
ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(classFile.getPathNameRelativeTo(virtualFile), virtualFile.getPathName(), e);
} finally {
VFSUtils.safeClose(inputStream);
}
}
final Index index = indexer.complete();
resourceRoot.putAttachment(Attachments.ANNOTATION_INDEX, index);
ServerLogger.DEPLOYMENT_LOGGER.tracef("Generated index for archive %s", virtualFile);
} catch (Throwable t) {
throw ServerLogger.ROOT_LOGGER.deploymentIndexingFailed(t);
}
}
|
java
|
public static void indexResourceRoot(final ResourceRoot resourceRoot) throws DeploymentUnitProcessingException {
if (resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX) != null) {
return;
}
VirtualFile indexFile = resourceRoot.getRoot().getChild(ModuleIndexBuilder.INDEX_LOCATION);
if (indexFile.exists()) {
try {
IndexReader reader = new IndexReader(indexFile.openStream());
resourceRoot.putAttachment(Attachments.ANNOTATION_INDEX, reader.read());
ServerLogger.DEPLOYMENT_LOGGER.tracef("Found and read index at: %s", indexFile);
return;
} catch (Exception e) {
ServerLogger.DEPLOYMENT_LOGGER.cannotLoadAnnotationIndex(indexFile.getPathName());
}
}
// if this flag is present and set to false then do not index the resource
Boolean shouldIndexResource = resourceRoot.getAttachment(Attachments.INDEX_RESOURCE_ROOT);
if (shouldIndexResource != null && !shouldIndexResource) {
return;
}
final List<String> indexIgnorePathList = resourceRoot.getAttachment(Attachments.INDEX_IGNORE_PATHS);
final Set<String> indexIgnorePaths;
if (indexIgnorePathList != null && !indexIgnorePathList.isEmpty()) {
indexIgnorePaths = new HashSet<String>(indexIgnorePathList);
} else {
indexIgnorePaths = null;
}
final VirtualFile virtualFile = resourceRoot.getRoot();
final Indexer indexer = new Indexer();
try {
final VisitorAttributes visitorAttributes = new VisitorAttributes();
visitorAttributes.setLeavesOnly(true);
visitorAttributes.setRecurseFilter(new VirtualFileFilter() {
public boolean accepts(VirtualFile file) {
return indexIgnorePaths == null || !indexIgnorePaths.contains(file.getPathNameRelativeTo(virtualFile));
}
});
final List<VirtualFile> classChildren = virtualFile.getChildren(new SuffixMatchFilter(".class", visitorAttributes));
for (VirtualFile classFile : classChildren) {
InputStream inputStream = null;
try {
inputStream = classFile.openStream();
indexer.index(inputStream);
} catch (Exception e) {
ServerLogger.DEPLOYMENT_LOGGER.cannotIndexClass(classFile.getPathNameRelativeTo(virtualFile), virtualFile.getPathName(), e);
} finally {
VFSUtils.safeClose(inputStream);
}
}
final Index index = indexer.complete();
resourceRoot.putAttachment(Attachments.ANNOTATION_INDEX, index);
ServerLogger.DEPLOYMENT_LOGGER.tracef("Generated index for archive %s", virtualFile);
} catch (Throwable t) {
throw ServerLogger.ROOT_LOGGER.deploymentIndexingFailed(t);
}
}
|
[
"public",
"static",
"void",
"indexResourceRoot",
"(",
"final",
"ResourceRoot",
"resourceRoot",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"if",
"(",
"resourceRoot",
".",
"getAttachment",
"(",
"Attachments",
".",
"ANNOTATION_INDEX",
")",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"VirtualFile",
"indexFile",
"=",
"resourceRoot",
".",
"getRoot",
"(",
")",
".",
"getChild",
"(",
"ModuleIndexBuilder",
".",
"INDEX_LOCATION",
")",
";",
"if",
"(",
"indexFile",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"IndexReader",
"reader",
"=",
"new",
"IndexReader",
"(",
"indexFile",
".",
"openStream",
"(",
")",
")",
";",
"resourceRoot",
".",
"putAttachment",
"(",
"Attachments",
".",
"ANNOTATION_INDEX",
",",
"reader",
".",
"read",
"(",
")",
")",
";",
"ServerLogger",
".",
"DEPLOYMENT_LOGGER",
".",
"tracef",
"(",
"\"Found and read index at: %s\"",
",",
"indexFile",
")",
";",
"return",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"ServerLogger",
".",
"DEPLOYMENT_LOGGER",
".",
"cannotLoadAnnotationIndex",
"(",
"indexFile",
".",
"getPathName",
"(",
")",
")",
";",
"}",
"}",
"// if this flag is present and set to false then do not index the resource",
"Boolean",
"shouldIndexResource",
"=",
"resourceRoot",
".",
"getAttachment",
"(",
"Attachments",
".",
"INDEX_RESOURCE_ROOT",
")",
";",
"if",
"(",
"shouldIndexResource",
"!=",
"null",
"&&",
"!",
"shouldIndexResource",
")",
"{",
"return",
";",
"}",
"final",
"List",
"<",
"String",
">",
"indexIgnorePathList",
"=",
"resourceRoot",
".",
"getAttachment",
"(",
"Attachments",
".",
"INDEX_IGNORE_PATHS",
")",
";",
"final",
"Set",
"<",
"String",
">",
"indexIgnorePaths",
";",
"if",
"(",
"indexIgnorePathList",
"!=",
"null",
"&&",
"!",
"indexIgnorePathList",
".",
"isEmpty",
"(",
")",
")",
"{",
"indexIgnorePaths",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
"indexIgnorePathList",
")",
";",
"}",
"else",
"{",
"indexIgnorePaths",
"=",
"null",
";",
"}",
"final",
"VirtualFile",
"virtualFile",
"=",
"resourceRoot",
".",
"getRoot",
"(",
")",
";",
"final",
"Indexer",
"indexer",
"=",
"new",
"Indexer",
"(",
")",
";",
"try",
"{",
"final",
"VisitorAttributes",
"visitorAttributes",
"=",
"new",
"VisitorAttributes",
"(",
")",
";",
"visitorAttributes",
".",
"setLeavesOnly",
"(",
"true",
")",
";",
"visitorAttributes",
".",
"setRecurseFilter",
"(",
"new",
"VirtualFileFilter",
"(",
")",
"{",
"public",
"boolean",
"accepts",
"(",
"VirtualFile",
"file",
")",
"{",
"return",
"indexIgnorePaths",
"==",
"null",
"||",
"!",
"indexIgnorePaths",
".",
"contains",
"(",
"file",
".",
"getPathNameRelativeTo",
"(",
"virtualFile",
")",
")",
";",
"}",
"}",
")",
";",
"final",
"List",
"<",
"VirtualFile",
">",
"classChildren",
"=",
"virtualFile",
".",
"getChildren",
"(",
"new",
"SuffixMatchFilter",
"(",
"\".class\"",
",",
"visitorAttributes",
")",
")",
";",
"for",
"(",
"VirtualFile",
"classFile",
":",
"classChildren",
")",
"{",
"InputStream",
"inputStream",
"=",
"null",
";",
"try",
"{",
"inputStream",
"=",
"classFile",
".",
"openStream",
"(",
")",
";",
"indexer",
".",
"index",
"(",
"inputStream",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"ServerLogger",
".",
"DEPLOYMENT_LOGGER",
".",
"cannotIndexClass",
"(",
"classFile",
".",
"getPathNameRelativeTo",
"(",
"virtualFile",
")",
",",
"virtualFile",
".",
"getPathName",
"(",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"VFSUtils",
".",
"safeClose",
"(",
"inputStream",
")",
";",
"}",
"}",
"final",
"Index",
"index",
"=",
"indexer",
".",
"complete",
"(",
")",
";",
"resourceRoot",
".",
"putAttachment",
"(",
"Attachments",
".",
"ANNOTATION_INDEX",
",",
"index",
")",
";",
"ServerLogger",
".",
"DEPLOYMENT_LOGGER",
".",
"tracef",
"(",
"\"Generated index for archive %s\"",
",",
"virtualFile",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"throw",
"ServerLogger",
".",
"ROOT_LOGGER",
".",
"deploymentIndexingFailed",
"(",
"t",
")",
";",
"}",
"}"
] |
Creates and attaches the annotation index to a resource root, if it has not already been attached
|
[
"Creates",
"and",
"attaches",
"the",
"annotation",
"index",
"to",
"a",
"resource",
"root",
"if",
"it",
"has",
"not",
"already",
"been",
"attached"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/annotation/ResourceRootIndexer.java#L52-L112
|
158,748 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/validation/PatchHistoryValidations.java
|
PatchHistoryValidations.validateRollbackState
|
public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException {
final Set<String> validHistory = processRollbackState(patchID, identity);
if (patchID != null && !validHistory.contains(patchID)) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID);
}
}
|
java
|
public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException {
final Set<String> validHistory = processRollbackState(patchID, identity);
if (patchID != null && !validHistory.contains(patchID)) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID);
}
}
|
[
"public",
"static",
"void",
"validateRollbackState",
"(",
"final",
"String",
"patchID",
",",
"final",
"InstalledIdentity",
"identity",
")",
"throws",
"PatchingException",
"{",
"final",
"Set",
"<",
"String",
">",
"validHistory",
"=",
"processRollbackState",
"(",
"patchID",
",",
"identity",
")",
";",
"if",
"(",
"patchID",
"!=",
"null",
"&&",
"!",
"validHistory",
".",
"contains",
"(",
"patchID",
")",
")",
"{",
"throw",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"patchNotFoundInHistory",
"(",
"patchID",
")",
";",
"}",
"}"
] |
Validate the consistency of patches to the point we rollback.
@param patchID the patch id which gets rolled back
@param identity the installed identity
@throws PatchingException
|
[
"Validate",
"the",
"consistency",
"of",
"patches",
"to",
"the",
"point",
"we",
"rollback",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/PatchHistoryValidations.java#L54-L59
|
158,749 |
wildfly/wildfly-core
|
server/src/main/java/org/jboss/as/server/deployment/JPADeploymentMarker.java
|
JPADeploymentMarker.mark
|
public static void mark(DeploymentUnit unit) {
unit = DeploymentUtils.getTopDeploymentUnit(unit);
unit.putAttachment(MARKER, Boolean.TRUE);
}
|
java
|
public static void mark(DeploymentUnit unit) {
unit = DeploymentUtils.getTopDeploymentUnit(unit);
unit.putAttachment(MARKER, Boolean.TRUE);
}
|
[
"public",
"static",
"void",
"mark",
"(",
"DeploymentUnit",
"unit",
")",
"{",
"unit",
"=",
"DeploymentUtils",
".",
"getTopDeploymentUnit",
"(",
"unit",
")",
";",
"unit",
".",
"putAttachment",
"(",
"MARKER",
",",
"Boolean",
".",
"TRUE",
")",
";",
"}"
] |
Mark the top level deployment as being a JPA deployment. If the deployment is not a top level deployment the parent is
marked instead
|
[
"Mark",
"the",
"top",
"level",
"deployment",
"as",
"being",
"a",
"JPA",
"deployment",
".",
"If",
"the",
"deployment",
"is",
"not",
"a",
"top",
"level",
"deployment",
"the",
"parent",
"is",
"marked",
"instead"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/JPADeploymentMarker.java#L39-L42
|
158,750 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/ContentRepositoryImpl.java
|
ContentRepositoryImpl.cleanObsoleteContent
|
@Override
public Map<String, Set<String>> cleanObsoleteContent() {
if(!readWrite) {
return Collections.emptyMap();
}
Map<String, Set<String>> cleanedContents = new HashMap<>(2);
cleanedContents.put(MARKED_CONTENT, new HashSet<>());
cleanedContents.put(DELETED_CONTENT, new HashSet<>());
synchronized (contentHashReferences) {
for (ContentReference fsContent : listLocalContents()) {
if (!readWrite) {
return Collections.emptyMap();
}
if (!contentHashReferences.containsKey(fsContent.getHexHash())) { //We have no reference to this content
if (markAsObsolete(fsContent)) {
cleanedContents.get(DELETED_CONTENT).add(fsContent.getContentIdentifier());
} else {
cleanedContents.get(MARKED_CONTENT).add(fsContent.getContentIdentifier());
}
} else {
obsoleteContents.remove(fsContent.getHexHash()); //Remove existing references from obsoleteContents
}
}
}
return cleanedContents;
}
|
java
|
@Override
public Map<String, Set<String>> cleanObsoleteContent() {
if(!readWrite) {
return Collections.emptyMap();
}
Map<String, Set<String>> cleanedContents = new HashMap<>(2);
cleanedContents.put(MARKED_CONTENT, new HashSet<>());
cleanedContents.put(DELETED_CONTENT, new HashSet<>());
synchronized (contentHashReferences) {
for (ContentReference fsContent : listLocalContents()) {
if (!readWrite) {
return Collections.emptyMap();
}
if (!contentHashReferences.containsKey(fsContent.getHexHash())) { //We have no reference to this content
if (markAsObsolete(fsContent)) {
cleanedContents.get(DELETED_CONTENT).add(fsContent.getContentIdentifier());
} else {
cleanedContents.get(MARKED_CONTENT).add(fsContent.getContentIdentifier());
}
} else {
obsoleteContents.remove(fsContent.getHexHash()); //Remove existing references from obsoleteContents
}
}
}
return cleanedContents;
}
|
[
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"cleanObsoleteContent",
"(",
")",
"{",
"if",
"(",
"!",
"readWrite",
")",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"cleanedContents",
"=",
"new",
"HashMap",
"<>",
"(",
"2",
")",
";",
"cleanedContents",
".",
"put",
"(",
"MARKED_CONTENT",
",",
"new",
"HashSet",
"<>",
"(",
")",
")",
";",
"cleanedContents",
".",
"put",
"(",
"DELETED_CONTENT",
",",
"new",
"HashSet",
"<>",
"(",
")",
")",
";",
"synchronized",
"(",
"contentHashReferences",
")",
"{",
"for",
"(",
"ContentReference",
"fsContent",
":",
"listLocalContents",
"(",
")",
")",
"{",
"if",
"(",
"!",
"readWrite",
")",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"}",
"if",
"(",
"!",
"contentHashReferences",
".",
"containsKey",
"(",
"fsContent",
".",
"getHexHash",
"(",
")",
")",
")",
"{",
"//We have no reference to this content",
"if",
"(",
"markAsObsolete",
"(",
"fsContent",
")",
")",
"{",
"cleanedContents",
".",
"get",
"(",
"DELETED_CONTENT",
")",
".",
"add",
"(",
"fsContent",
".",
"getContentIdentifier",
"(",
")",
")",
";",
"}",
"else",
"{",
"cleanedContents",
".",
"get",
"(",
"MARKED_CONTENT",
")",
".",
"add",
"(",
"fsContent",
".",
"getContentIdentifier",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"obsoleteContents",
".",
"remove",
"(",
"fsContent",
".",
"getHexHash",
"(",
")",
")",
";",
"//Remove existing references from obsoleteContents",
"}",
"}",
"}",
"return",
"cleanedContents",
";",
"}"
] |
Clean obsolete contents from the content repository. It will first mark contents as obsolete then after some time
if these contents are still obsolete they will be removed.
@return a map containing the list of marked contents and the list of deleted contents.
|
[
"Clean",
"obsolete",
"contents",
"from",
"the",
"content",
"repository",
".",
"It",
"will",
"first",
"mark",
"contents",
"as",
"obsolete",
"then",
"after",
"some",
"time",
"if",
"these",
"contents",
"are",
"still",
"obsolete",
"they",
"will",
"be",
"removed",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/ContentRepositoryImpl.java#L338-L363
|
158,751 |
wildfly/wildfly-core
|
deployment-repository/src/main/java/org/jboss/as/repository/ContentRepositoryImpl.java
|
ContentRepositoryImpl.markAsObsolete
|
private boolean markAsObsolete(ContentReference ref) {
if (obsoleteContents.containsKey(ref.getHexHash())) { //This content is already marked as obsolete
if (obsoleteContents.get(ref.getHexHash()) + obsolescenceTimeout < System.currentTimeMillis()) {
DeploymentRepositoryLogger.ROOT_LOGGER.obsoleteContentCleaned(ref.getContentIdentifier());
removeContent(ref);
return true;
}
} else {
obsoleteContents.put(ref.getHexHash(), System.currentTimeMillis()); //Mark content as obsolete
}
return false;
}
|
java
|
private boolean markAsObsolete(ContentReference ref) {
if (obsoleteContents.containsKey(ref.getHexHash())) { //This content is already marked as obsolete
if (obsoleteContents.get(ref.getHexHash()) + obsolescenceTimeout < System.currentTimeMillis()) {
DeploymentRepositoryLogger.ROOT_LOGGER.obsoleteContentCleaned(ref.getContentIdentifier());
removeContent(ref);
return true;
}
} else {
obsoleteContents.put(ref.getHexHash(), System.currentTimeMillis()); //Mark content as obsolete
}
return false;
}
|
[
"private",
"boolean",
"markAsObsolete",
"(",
"ContentReference",
"ref",
")",
"{",
"if",
"(",
"obsoleteContents",
".",
"containsKey",
"(",
"ref",
".",
"getHexHash",
"(",
")",
")",
")",
"{",
"//This content is already marked as obsolete",
"if",
"(",
"obsoleteContents",
".",
"get",
"(",
"ref",
".",
"getHexHash",
"(",
")",
")",
"+",
"obsolescenceTimeout",
"<",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
"{",
"DeploymentRepositoryLogger",
".",
"ROOT_LOGGER",
".",
"obsoleteContentCleaned",
"(",
"ref",
".",
"getContentIdentifier",
"(",
")",
")",
";",
"removeContent",
"(",
"ref",
")",
";",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"obsoleteContents",
".",
"put",
"(",
"ref",
".",
"getHexHash",
"(",
")",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"//Mark content as obsolete",
"}",
"return",
"false",
";",
"}"
] |
Mark content as obsolete. If content was already marked for obsolescenceTimeout ms then it is removed.
@param ref the content refrence to be marked as obsolete.
@return true if the content refrence is removed, fale otherwise.
|
[
"Mark",
"content",
"as",
"obsolete",
".",
"If",
"content",
"was",
"already",
"marked",
"for",
"obsolescenceTimeout",
"ms",
"then",
"it",
"is",
"removed",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/ContentRepositoryImpl.java#L372-L383
|
158,752 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java
|
ReadMasterDomainModelUtil.readMasterDomainResourcesForInitialConnect
|
static ReadMasterDomainModelUtil readMasterDomainResourcesForInitialConnect(final Transformers transformers,
final Transformers.TransformationInputs transformationInputs,
final Transformers.ResourceIgnoredTransformationRegistry ignoredTransformationRegistry,
final Resource domainRoot) throws OperationFailedException {
Resource transformedResource = transformers.transformRootResource(transformationInputs, domainRoot, ignoredTransformationRegistry);
ReadMasterDomainModelUtil util = new ReadMasterDomainModelUtil();
util.describedResources = util.describeAsNodeList(PathAddress.EMPTY_ADDRESS, transformedResource, false);
return util;
}
|
java
|
static ReadMasterDomainModelUtil readMasterDomainResourcesForInitialConnect(final Transformers transformers,
final Transformers.TransformationInputs transformationInputs,
final Transformers.ResourceIgnoredTransformationRegistry ignoredTransformationRegistry,
final Resource domainRoot) throws OperationFailedException {
Resource transformedResource = transformers.transformRootResource(transformationInputs, domainRoot, ignoredTransformationRegistry);
ReadMasterDomainModelUtil util = new ReadMasterDomainModelUtil();
util.describedResources = util.describeAsNodeList(PathAddress.EMPTY_ADDRESS, transformedResource, false);
return util;
}
|
[
"static",
"ReadMasterDomainModelUtil",
"readMasterDomainResourcesForInitialConnect",
"(",
"final",
"Transformers",
"transformers",
",",
"final",
"Transformers",
".",
"TransformationInputs",
"transformationInputs",
",",
"final",
"Transformers",
".",
"ResourceIgnoredTransformationRegistry",
"ignoredTransformationRegistry",
",",
"final",
"Resource",
"domainRoot",
")",
"throws",
"OperationFailedException",
"{",
"Resource",
"transformedResource",
"=",
"transformers",
".",
"transformRootResource",
"(",
"transformationInputs",
",",
"domainRoot",
",",
"ignoredTransformationRegistry",
")",
";",
"ReadMasterDomainModelUtil",
"util",
"=",
"new",
"ReadMasterDomainModelUtil",
"(",
")",
";",
"util",
".",
"describedResources",
"=",
"util",
".",
"describeAsNodeList",
"(",
"PathAddress",
".",
"EMPTY_ADDRESS",
",",
"transformedResource",
",",
"false",
")",
";",
"return",
"util",
";",
"}"
] |
Used to read the domain model when a slave host connects to the DC
@param transformers the transformers for the host
@param transformationInputs parameters for the transformation
@param ignoredTransformationRegistry registry of resources ignored by the transformation target
@param domainRoot the root resource for the domain resource tree
@return a read master domain model util instance
|
[
"Used",
"to",
"read",
"the",
"domain",
"model",
"when",
"a",
"slave",
"host",
"connects",
"to",
"the",
"DC"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L84-L93
|
158,753 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java
|
ReadMasterDomainModelUtil.describeAsNodeList
|
private List<ModelNode> describeAsNodeList(PathAddress rootAddress, final Resource resource, boolean isRuntimeChange) {
final List<ModelNode> list = new ArrayList<ModelNode>();
describe(rootAddress, resource, list, isRuntimeChange);
return list;
}
|
java
|
private List<ModelNode> describeAsNodeList(PathAddress rootAddress, final Resource resource, boolean isRuntimeChange) {
final List<ModelNode> list = new ArrayList<ModelNode>();
describe(rootAddress, resource, list, isRuntimeChange);
return list;
}
|
[
"private",
"List",
"<",
"ModelNode",
">",
"describeAsNodeList",
"(",
"PathAddress",
"rootAddress",
",",
"final",
"Resource",
"resource",
",",
"boolean",
"isRuntimeChange",
")",
"{",
"final",
"List",
"<",
"ModelNode",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"ModelNode",
">",
"(",
")",
";",
"describe",
"(",
"rootAddress",
",",
"resource",
",",
"list",
",",
"isRuntimeChange",
")",
";",
"return",
"list",
";",
"}"
] |
Describe the model as a list of resources with their address and model, which
the HC can directly apply to create the model. Although the format might appear
similar as the operations generated at boot-time this description is only useful
to create the resource tree and cannot be used to invoke any operation.
@param rootAddress the address of the root resource being described
@param resource the root resource
@return the list of resources
|
[
"Describe",
"the",
"model",
"as",
"a",
"list",
"of",
"resources",
"with",
"their",
"address",
"and",
"model",
"which",
"the",
"HC",
"can",
"directly",
"apply",
"to",
"create",
"the",
"model",
".",
"Although",
"the",
"format",
"might",
"appear",
"similar",
"as",
"the",
"operations",
"generated",
"at",
"boot",
"-",
"time",
"this",
"description",
"is",
"only",
"useful",
"to",
"create",
"the",
"resource",
"tree",
"and",
"cannot",
"be",
"used",
"to",
"invoke",
"any",
"operation",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L116-L121
|
158,754 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java
|
ReadMasterDomainModelUtil.populateHostResolutionContext
|
public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) {
final RequiredConfigurationHolder rc = new RequiredConfigurationHolder();
for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hostInfo.getServerConfigInfos()) {
processServerConfig(root, rc, info, extensionRegistry);
}
return rc;
}
|
java
|
public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) {
final RequiredConfigurationHolder rc = new RequiredConfigurationHolder();
for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hostInfo.getServerConfigInfos()) {
processServerConfig(root, rc, info, extensionRegistry);
}
return rc;
}
|
[
"public",
"static",
"RequiredConfigurationHolder",
"populateHostResolutionContext",
"(",
"final",
"HostInfo",
"hostInfo",
",",
"final",
"Resource",
"root",
",",
"final",
"ExtensionRegistry",
"extensionRegistry",
")",
"{",
"final",
"RequiredConfigurationHolder",
"rc",
"=",
"new",
"RequiredConfigurationHolder",
"(",
")",
";",
"for",
"(",
"IgnoredNonAffectedServerGroupsUtil",
".",
"ServerConfigInfo",
"info",
":",
"hostInfo",
".",
"getServerConfigInfos",
"(",
")",
")",
"{",
"processServerConfig",
"(",
"root",
",",
"rc",
",",
"info",
",",
"extensionRegistry",
")",
";",
"}",
"return",
"rc",
";",
"}"
] |
Process the host info and determine which configuration elements are required on the slave host.
@param hostInfo the host info
@param root the model root
@param extensionRegistry the extension registry
@return
|
[
"Process",
"the",
"host",
"info",
"and",
"determine",
"which",
"configuration",
"elements",
"are",
"required",
"on",
"the",
"slave",
"host",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L224-L230
|
158,755 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java
|
ReadMasterDomainModelUtil.processServerConfig
|
static void processServerConfig(final Resource root, final RequiredConfigurationHolder requiredConfigurationHolder, final IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo serverConfig, final ExtensionRegistry extensionRegistry) {
final Set<String> serverGroups = requiredConfigurationHolder.serverGroups;
final Set<String> socketBindings = requiredConfigurationHolder.socketBindings;
String sbg = serverConfig.getSocketBindingGroup();
if (sbg != null && !socketBindings.contains(sbg)) {
processSocketBindingGroup(root, sbg, requiredConfigurationHolder);
}
final String groupName = serverConfig.getServerGroup();
final PathElement groupElement = PathElement.pathElement(SERVER_GROUP, groupName);
// Also check the root, since this also gets executed on the slave which may not have the server-group configured yet
if (!serverGroups.contains(groupName) && root.hasChild(groupElement)) {
final Resource serverGroup = root.getChild(groupElement);
final ModelNode groupModel = serverGroup.getModel();
serverGroups.add(groupName);
// Include the socket binding groups
if (groupModel.hasDefined(SOCKET_BINDING_GROUP)) {
final String socketBindingGroup = groupModel.get(SOCKET_BINDING_GROUP).asString();
processSocketBindingGroup(root, socketBindingGroup, requiredConfigurationHolder);
}
final String profileName = groupModel.get(PROFILE).asString();
processProfile(root, profileName, requiredConfigurationHolder, extensionRegistry);
}
}
|
java
|
static void processServerConfig(final Resource root, final RequiredConfigurationHolder requiredConfigurationHolder, final IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo serverConfig, final ExtensionRegistry extensionRegistry) {
final Set<String> serverGroups = requiredConfigurationHolder.serverGroups;
final Set<String> socketBindings = requiredConfigurationHolder.socketBindings;
String sbg = serverConfig.getSocketBindingGroup();
if (sbg != null && !socketBindings.contains(sbg)) {
processSocketBindingGroup(root, sbg, requiredConfigurationHolder);
}
final String groupName = serverConfig.getServerGroup();
final PathElement groupElement = PathElement.pathElement(SERVER_GROUP, groupName);
// Also check the root, since this also gets executed on the slave which may not have the server-group configured yet
if (!serverGroups.contains(groupName) && root.hasChild(groupElement)) {
final Resource serverGroup = root.getChild(groupElement);
final ModelNode groupModel = serverGroup.getModel();
serverGroups.add(groupName);
// Include the socket binding groups
if (groupModel.hasDefined(SOCKET_BINDING_GROUP)) {
final String socketBindingGroup = groupModel.get(SOCKET_BINDING_GROUP).asString();
processSocketBindingGroup(root, socketBindingGroup, requiredConfigurationHolder);
}
final String profileName = groupModel.get(PROFILE).asString();
processProfile(root, profileName, requiredConfigurationHolder, extensionRegistry);
}
}
|
[
"static",
"void",
"processServerConfig",
"(",
"final",
"Resource",
"root",
",",
"final",
"RequiredConfigurationHolder",
"requiredConfigurationHolder",
",",
"final",
"IgnoredNonAffectedServerGroupsUtil",
".",
"ServerConfigInfo",
"serverConfig",
",",
"final",
"ExtensionRegistry",
"extensionRegistry",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"serverGroups",
"=",
"requiredConfigurationHolder",
".",
"serverGroups",
";",
"final",
"Set",
"<",
"String",
">",
"socketBindings",
"=",
"requiredConfigurationHolder",
".",
"socketBindings",
";",
"String",
"sbg",
"=",
"serverConfig",
".",
"getSocketBindingGroup",
"(",
")",
";",
"if",
"(",
"sbg",
"!=",
"null",
"&&",
"!",
"socketBindings",
".",
"contains",
"(",
"sbg",
")",
")",
"{",
"processSocketBindingGroup",
"(",
"root",
",",
"sbg",
",",
"requiredConfigurationHolder",
")",
";",
"}",
"final",
"String",
"groupName",
"=",
"serverConfig",
".",
"getServerGroup",
"(",
")",
";",
"final",
"PathElement",
"groupElement",
"=",
"PathElement",
".",
"pathElement",
"(",
"SERVER_GROUP",
",",
"groupName",
")",
";",
"// Also check the root, since this also gets executed on the slave which may not have the server-group configured yet",
"if",
"(",
"!",
"serverGroups",
".",
"contains",
"(",
"groupName",
")",
"&&",
"root",
".",
"hasChild",
"(",
"groupElement",
")",
")",
"{",
"final",
"Resource",
"serverGroup",
"=",
"root",
".",
"getChild",
"(",
"groupElement",
")",
";",
"final",
"ModelNode",
"groupModel",
"=",
"serverGroup",
".",
"getModel",
"(",
")",
";",
"serverGroups",
".",
"add",
"(",
"groupName",
")",
";",
"// Include the socket binding groups",
"if",
"(",
"groupModel",
".",
"hasDefined",
"(",
"SOCKET_BINDING_GROUP",
")",
")",
"{",
"final",
"String",
"socketBindingGroup",
"=",
"groupModel",
".",
"get",
"(",
"SOCKET_BINDING_GROUP",
")",
".",
"asString",
"(",
")",
";",
"processSocketBindingGroup",
"(",
"root",
",",
"socketBindingGroup",
",",
"requiredConfigurationHolder",
")",
";",
"}",
"final",
"String",
"profileName",
"=",
"groupModel",
".",
"get",
"(",
"PROFILE",
")",
".",
"asString",
"(",
")",
";",
"processProfile",
"(",
"root",
",",
"profileName",
",",
"requiredConfigurationHolder",
",",
"extensionRegistry",
")",
";",
"}",
"}"
] |
Determine the relevant pieces of configuration which need to be included when processing the domain model.
@param root the resource root
@param requiredConfigurationHolder the resolution context
@param serverConfig the server config
@param extensionRegistry the extension registry
|
[
"Determine",
"the",
"relevant",
"pieces",
"of",
"configuration",
"which",
"need",
"to",
"be",
"included",
"when",
"processing",
"the",
"domain",
"model",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L240-L268
|
158,756 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java
|
ReadMasterDomainModelUtil.createServerIgnoredRegistry
|
public static Transformers.ResourceIgnoredTransformationRegistry createServerIgnoredRegistry(final RequiredConfigurationHolder rc, final Transformers.ResourceIgnoredTransformationRegistry delegate) {
return new Transformers.ResourceIgnoredTransformationRegistry() {
@Override
public boolean isResourceTransformationIgnored(PathAddress address) {
final int length = address.size();
if (length == 0) {
return false;
} else if (length >= 1) {
if (delegate.isResourceTransformationIgnored(address)) {
return true;
}
final PathElement element = address.getElement(0);
final String type = element.getKey();
switch (type) {
case ModelDescriptionConstants.EXTENSION:
// Don't ignore extensions for now
return false;
// if (local) {
// return false; // Always include all local extensions
// } else if (rc.getExtensions().contains(element.getValue())) {
// return false;
// }
// break;
case ModelDescriptionConstants.PROFILE:
if (rc.getProfiles().contains(element.getValue())) {
return false;
}
break;
case ModelDescriptionConstants.SERVER_GROUP:
if (rc.getServerGroups().contains(element.getValue())) {
return false;
}
break;
case ModelDescriptionConstants.SOCKET_BINDING_GROUP:
if (rc.getSocketBindings().contains(element.getValue())) {
return false;
}
break;
}
}
return true;
}
};
}
|
java
|
public static Transformers.ResourceIgnoredTransformationRegistry createServerIgnoredRegistry(final RequiredConfigurationHolder rc, final Transformers.ResourceIgnoredTransformationRegistry delegate) {
return new Transformers.ResourceIgnoredTransformationRegistry() {
@Override
public boolean isResourceTransformationIgnored(PathAddress address) {
final int length = address.size();
if (length == 0) {
return false;
} else if (length >= 1) {
if (delegate.isResourceTransformationIgnored(address)) {
return true;
}
final PathElement element = address.getElement(0);
final String type = element.getKey();
switch (type) {
case ModelDescriptionConstants.EXTENSION:
// Don't ignore extensions for now
return false;
// if (local) {
// return false; // Always include all local extensions
// } else if (rc.getExtensions().contains(element.getValue())) {
// return false;
// }
// break;
case ModelDescriptionConstants.PROFILE:
if (rc.getProfiles().contains(element.getValue())) {
return false;
}
break;
case ModelDescriptionConstants.SERVER_GROUP:
if (rc.getServerGroups().contains(element.getValue())) {
return false;
}
break;
case ModelDescriptionConstants.SOCKET_BINDING_GROUP:
if (rc.getSocketBindings().contains(element.getValue())) {
return false;
}
break;
}
}
return true;
}
};
}
|
[
"public",
"static",
"Transformers",
".",
"ResourceIgnoredTransformationRegistry",
"createServerIgnoredRegistry",
"(",
"final",
"RequiredConfigurationHolder",
"rc",
",",
"final",
"Transformers",
".",
"ResourceIgnoredTransformationRegistry",
"delegate",
")",
"{",
"return",
"new",
"Transformers",
".",
"ResourceIgnoredTransformationRegistry",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"isResourceTransformationIgnored",
"(",
"PathAddress",
"address",
")",
"{",
"final",
"int",
"length",
"=",
"address",
".",
"size",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"length",
">=",
"1",
")",
"{",
"if",
"(",
"delegate",
".",
"isResourceTransformationIgnored",
"(",
"address",
")",
")",
"{",
"return",
"true",
";",
"}",
"final",
"PathElement",
"element",
"=",
"address",
".",
"getElement",
"(",
"0",
")",
";",
"final",
"String",
"type",
"=",
"element",
".",
"getKey",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"ModelDescriptionConstants",
".",
"EXTENSION",
":",
"// Don't ignore extensions for now",
"return",
"false",
";",
"// if (local) {",
"// return false; // Always include all local extensions",
"// } else if (rc.getExtensions().contains(element.getValue())) {",
"// return false;",
"// }",
"// break;",
"case",
"ModelDescriptionConstants",
".",
"PROFILE",
":",
"if",
"(",
"rc",
".",
"getProfiles",
"(",
")",
".",
"contains",
"(",
"element",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"ModelDescriptionConstants",
".",
"SERVER_GROUP",
":",
"if",
"(",
"rc",
".",
"getServerGroups",
"(",
")",
".",
"contains",
"(",
"element",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"case",
"ModelDescriptionConstants",
".",
"SOCKET_BINDING_GROUP",
":",
"if",
"(",
"rc",
".",
"getSocketBindings",
"(",
")",
".",
"contains",
"(",
"element",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"break",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
";",
"}"
] |
Create the ResourceIgnoredTransformationRegistry when fetching missing content, only including relevant pieces
to a server-config.
@param rc the resolution context
@param delegate the delegate ignored resource transformation registry for manually ignored resources
@return
|
[
"Create",
"the",
"ResourceIgnoredTransformationRegistry",
"when",
"fetching",
"missing",
"content",
"only",
"including",
"relevant",
"pieces",
"to",
"a",
"server",
"-",
"config",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L422-L466
|
158,757 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java
|
IgnoredNonAffectedServerGroupsUtil.addCurrentServerGroupsToHostInfoModel
|
public static ModelNode addCurrentServerGroupsToHostInfoModel(boolean ignoreUnaffectedServerGroups, Resource hostModel, ModelNode model) {
if (!ignoreUnaffectedServerGroups) {
return model;
}
model.get(IGNORE_UNUSED_CONFIG).set(ignoreUnaffectedServerGroups);
addServerGroupsToModel(hostModel, model);
return model;
}
|
java
|
public static ModelNode addCurrentServerGroupsToHostInfoModel(boolean ignoreUnaffectedServerGroups, Resource hostModel, ModelNode model) {
if (!ignoreUnaffectedServerGroups) {
return model;
}
model.get(IGNORE_UNUSED_CONFIG).set(ignoreUnaffectedServerGroups);
addServerGroupsToModel(hostModel, model);
return model;
}
|
[
"public",
"static",
"ModelNode",
"addCurrentServerGroupsToHostInfoModel",
"(",
"boolean",
"ignoreUnaffectedServerGroups",
",",
"Resource",
"hostModel",
",",
"ModelNode",
"model",
")",
"{",
"if",
"(",
"!",
"ignoreUnaffectedServerGroups",
")",
"{",
"return",
"model",
";",
"}",
"model",
".",
"get",
"(",
"IGNORE_UNUSED_CONFIG",
")",
".",
"set",
"(",
"ignoreUnaffectedServerGroups",
")",
";",
"addServerGroupsToModel",
"(",
"hostModel",
",",
"model",
")",
";",
"return",
"model",
";",
"}"
] |
Used by the slave host when creating the host info dmr sent across to the DC during the registration process
@param ignoreUnaffectedServerGroups whether the slave host is set up to ignore config for server groups it does not have servers for
@param hostModel the resource containing the host model
@param model the dmr sent across to theDC
@return the modified dmr
|
[
"Used",
"by",
"the",
"slave",
"host",
"when",
"creating",
"the",
"host",
"info",
"dmr",
"sent",
"across",
"to",
"the",
"DC",
"during",
"the",
"registration",
"process"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java#L84-L91
|
158,758 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java
|
IgnoredNonAffectedServerGroupsUtil.ignoreOperation
|
public boolean ignoreOperation(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final PathAddress pathAddress) {
if (pathAddress.size() == 0) {
return false;
}
boolean ignore = ignoreResourceInternal(domainResource, serverConfigs, pathAddress);
return ignore;
}
|
java
|
public boolean ignoreOperation(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final PathAddress pathAddress) {
if (pathAddress.size() == 0) {
return false;
}
boolean ignore = ignoreResourceInternal(domainResource, serverConfigs, pathAddress);
return ignore;
}
|
[
"public",
"boolean",
"ignoreOperation",
"(",
"final",
"Resource",
"domainResource",
",",
"final",
"Collection",
"<",
"ServerConfigInfo",
">",
"serverConfigs",
",",
"final",
"PathAddress",
"pathAddress",
")",
"{",
"if",
"(",
"pathAddress",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"ignore",
"=",
"ignoreResourceInternal",
"(",
"domainResource",
",",
"serverConfigs",
",",
"pathAddress",
")",
";",
"return",
"ignore",
";",
"}"
] |
For the DC to check whether an operation should be ignored on the slave, if the slave is set up to ignore config not relevant to it
@param domainResource the domain root resource
@param serverConfigs the server configs the slave is known to have
@param pathAddress the address of the operation to check if should be ignored or not
|
[
"For",
"the",
"DC",
"to",
"check",
"whether",
"an",
"operation",
"should",
"be",
"ignored",
"on",
"the",
"slave",
"if",
"the",
"slave",
"is",
"set",
"up",
"to",
"ignore",
"config",
"not",
"relevant",
"to",
"it"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java#L128-L134
|
158,759 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java
|
IgnoredNonAffectedServerGroupsUtil.getServerConfigsOnSlave
|
public Set<ServerConfigInfo> getServerConfigsOnSlave(Resource hostResource){
Set<ServerConfigInfo> groups = new HashSet<>();
for (ResourceEntry entry : hostResource.getChildren(SERVER_CONFIG)) {
groups.add(new ServerConfigInfoImpl(entry.getModel()));
}
return groups;
}
|
java
|
public Set<ServerConfigInfo> getServerConfigsOnSlave(Resource hostResource){
Set<ServerConfigInfo> groups = new HashSet<>();
for (ResourceEntry entry : hostResource.getChildren(SERVER_CONFIG)) {
groups.add(new ServerConfigInfoImpl(entry.getModel()));
}
return groups;
}
|
[
"public",
"Set",
"<",
"ServerConfigInfo",
">",
"getServerConfigsOnSlave",
"(",
"Resource",
"hostResource",
")",
"{",
"Set",
"<",
"ServerConfigInfo",
">",
"groups",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"ResourceEntry",
"entry",
":",
"hostResource",
".",
"getChildren",
"(",
"SERVER_CONFIG",
")",
")",
"{",
"groups",
".",
"add",
"(",
"new",
"ServerConfigInfoImpl",
"(",
"entry",
".",
"getModel",
"(",
")",
")",
")",
";",
"}",
"return",
"groups",
";",
"}"
] |
For use on a slave HC to get all the server groups used by the host
@param hostResource the host resource
@return the server configs on this host
|
[
"For",
"use",
"on",
"a",
"slave",
"HC",
"to",
"get",
"all",
"the",
"server",
"groups",
"used",
"by",
"the",
"host"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java#L261-L267
|
158,760 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/operations/SyncModelOperationHandlerWrapper.java
|
SyncModelOperationHandlerWrapper.syncWithMaster
|
private static boolean syncWithMaster(final Resource domain, final PathElement hostElement) {
final Resource host = domain.getChild(hostElement);
assert host != null;
final Set<String> profiles = new HashSet<>();
final Set<String> serverGroups = new HashSet<>();
final Set<String> socketBindings = new HashSet<>();
for (final Resource.ResourceEntry serverConfig : host.getChildren(SERVER_CONFIG)) {
final ModelNode model = serverConfig.getModel();
final String group = model.require(GROUP).asString();
if (!serverGroups.contains(group)) {
serverGroups.add(group);
}
if (model.hasDefined(SOCKET_BINDING_GROUP)) {
processSocketBindingGroup(domain, model.require(SOCKET_BINDING_GROUP).asString(), socketBindings);
}
}
// process referenced server-groups
for (final Resource.ResourceEntry serverGroup : domain.getChildren(SERVER_GROUP)) {
// If we have an unreferenced server-group
if (!serverGroups.remove(serverGroup.getName())) {
return true;
}
final ModelNode model = serverGroup.getModel();
final String profile = model.require(PROFILE).asString();
// Process the profile
processProfile(domain, profile, profiles);
// Process the socket-binding-group
processSocketBindingGroup(domain, model.require(SOCKET_BINDING_GROUP).asString(), socketBindings);
}
// If we are missing a server group
if (!serverGroups.isEmpty()) {
return true;
}
// Process profiles
for (final Resource.ResourceEntry profile : domain.getChildren(PROFILE)) {
// We have an unreferenced profile
if (!profiles.remove(profile.getName())) {
return true;
}
}
// We are missing a profile
if (!profiles.isEmpty()) {
return true;
}
// Process socket-binding groups
for (final Resource.ResourceEntry socketBindingGroup : domain.getChildren(SOCKET_BINDING_GROUP)) {
// We have an unreferenced socket-binding group
if (!socketBindings.remove(socketBindingGroup.getName())) {
return true;
}
}
// We are missing a socket-binding group
if (!socketBindings.isEmpty()) {
return true;
}
// Looks good!
return false;
}
|
java
|
private static boolean syncWithMaster(final Resource domain, final PathElement hostElement) {
final Resource host = domain.getChild(hostElement);
assert host != null;
final Set<String> profiles = new HashSet<>();
final Set<String> serverGroups = new HashSet<>();
final Set<String> socketBindings = new HashSet<>();
for (final Resource.ResourceEntry serverConfig : host.getChildren(SERVER_CONFIG)) {
final ModelNode model = serverConfig.getModel();
final String group = model.require(GROUP).asString();
if (!serverGroups.contains(group)) {
serverGroups.add(group);
}
if (model.hasDefined(SOCKET_BINDING_GROUP)) {
processSocketBindingGroup(domain, model.require(SOCKET_BINDING_GROUP).asString(), socketBindings);
}
}
// process referenced server-groups
for (final Resource.ResourceEntry serverGroup : domain.getChildren(SERVER_GROUP)) {
// If we have an unreferenced server-group
if (!serverGroups.remove(serverGroup.getName())) {
return true;
}
final ModelNode model = serverGroup.getModel();
final String profile = model.require(PROFILE).asString();
// Process the profile
processProfile(domain, profile, profiles);
// Process the socket-binding-group
processSocketBindingGroup(domain, model.require(SOCKET_BINDING_GROUP).asString(), socketBindings);
}
// If we are missing a server group
if (!serverGroups.isEmpty()) {
return true;
}
// Process profiles
for (final Resource.ResourceEntry profile : domain.getChildren(PROFILE)) {
// We have an unreferenced profile
if (!profiles.remove(profile.getName())) {
return true;
}
}
// We are missing a profile
if (!profiles.isEmpty()) {
return true;
}
// Process socket-binding groups
for (final Resource.ResourceEntry socketBindingGroup : domain.getChildren(SOCKET_BINDING_GROUP)) {
// We have an unreferenced socket-binding group
if (!socketBindings.remove(socketBindingGroup.getName())) {
return true;
}
}
// We are missing a socket-binding group
if (!socketBindings.isEmpty()) {
return true;
}
// Looks good!
return false;
}
|
[
"private",
"static",
"boolean",
"syncWithMaster",
"(",
"final",
"Resource",
"domain",
",",
"final",
"PathElement",
"hostElement",
")",
"{",
"final",
"Resource",
"host",
"=",
"domain",
".",
"getChild",
"(",
"hostElement",
")",
";",
"assert",
"host",
"!=",
"null",
";",
"final",
"Set",
"<",
"String",
">",
"profiles",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"final",
"Set",
"<",
"String",
">",
"serverGroups",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"final",
"Set",
"<",
"String",
">",
"socketBindings",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Resource",
".",
"ResourceEntry",
"serverConfig",
":",
"host",
".",
"getChildren",
"(",
"SERVER_CONFIG",
")",
")",
"{",
"final",
"ModelNode",
"model",
"=",
"serverConfig",
".",
"getModel",
"(",
")",
";",
"final",
"String",
"group",
"=",
"model",
".",
"require",
"(",
"GROUP",
")",
".",
"asString",
"(",
")",
";",
"if",
"(",
"!",
"serverGroups",
".",
"contains",
"(",
"group",
")",
")",
"{",
"serverGroups",
".",
"add",
"(",
"group",
")",
";",
"}",
"if",
"(",
"model",
".",
"hasDefined",
"(",
"SOCKET_BINDING_GROUP",
")",
")",
"{",
"processSocketBindingGroup",
"(",
"domain",
",",
"model",
".",
"require",
"(",
"SOCKET_BINDING_GROUP",
")",
".",
"asString",
"(",
")",
",",
"socketBindings",
")",
";",
"}",
"}",
"// process referenced server-groups",
"for",
"(",
"final",
"Resource",
".",
"ResourceEntry",
"serverGroup",
":",
"domain",
".",
"getChildren",
"(",
"SERVER_GROUP",
")",
")",
"{",
"// If we have an unreferenced server-group",
"if",
"(",
"!",
"serverGroups",
".",
"remove",
"(",
"serverGroup",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"final",
"ModelNode",
"model",
"=",
"serverGroup",
".",
"getModel",
"(",
")",
";",
"final",
"String",
"profile",
"=",
"model",
".",
"require",
"(",
"PROFILE",
")",
".",
"asString",
"(",
")",
";",
"// Process the profile",
"processProfile",
"(",
"domain",
",",
"profile",
",",
"profiles",
")",
";",
"// Process the socket-binding-group",
"processSocketBindingGroup",
"(",
"domain",
",",
"model",
".",
"require",
"(",
"SOCKET_BINDING_GROUP",
")",
".",
"asString",
"(",
")",
",",
"socketBindings",
")",
";",
"}",
"// If we are missing a server group",
"if",
"(",
"!",
"serverGroups",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Process profiles",
"for",
"(",
"final",
"Resource",
".",
"ResourceEntry",
"profile",
":",
"domain",
".",
"getChildren",
"(",
"PROFILE",
")",
")",
"{",
"// We have an unreferenced profile",
"if",
"(",
"!",
"profiles",
".",
"remove",
"(",
"profile",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"// We are missing a profile",
"if",
"(",
"!",
"profiles",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Process socket-binding groups",
"for",
"(",
"final",
"Resource",
".",
"ResourceEntry",
"socketBindingGroup",
":",
"domain",
".",
"getChildren",
"(",
"SOCKET_BINDING_GROUP",
")",
")",
"{",
"// We have an unreferenced socket-binding group",
"if",
"(",
"!",
"socketBindings",
".",
"remove",
"(",
"socketBindingGroup",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"// We are missing a socket-binding group",
"if",
"(",
"!",
"socketBindings",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Looks good!",
"return",
"false",
";",
"}"
] |
Determine whether all references are available locally.
@param domain the domain model
@param hostElement the host path element
@return whether to a sync with the master is required
|
[
"Determine",
"whether",
"all",
"references",
"are",
"available",
"locally",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/SyncModelOperationHandlerWrapper.java#L154-L216
|
158,761 |
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java
|
CLI.cmd
|
public Result cmd(String cliCommand) {
try {
// The intent here is to return a Response when this is doable.
if (ctx.isWorkflowMode() || ctx.isBatchMode()) {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
handler.parse(ctx.getCurrentNodePath(), cliCommand, ctx);
if (handler.getFormat() == OperationFormat.INSTANCE) {
ModelNode request = ctx.buildRequest(cliCommand);
ModelNode response = ctx.execute(request, cliCommand);
return new Result(cliCommand, request, response);
} else {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
} catch (CommandLineException cfe) {
throw new IllegalArgumentException("Error handling command: "
+ cliCommand, cfe);
} catch (IOException ioe) {
throw new IllegalStateException("Unable to send command "
+ cliCommand + " to server.", ioe);
}
}
|
java
|
public Result cmd(String cliCommand) {
try {
// The intent here is to return a Response when this is doable.
if (ctx.isWorkflowMode() || ctx.isBatchMode()) {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
handler.parse(ctx.getCurrentNodePath(), cliCommand, ctx);
if (handler.getFormat() == OperationFormat.INSTANCE) {
ModelNode request = ctx.buildRequest(cliCommand);
ModelNode response = ctx.execute(request, cliCommand);
return new Result(cliCommand, request, response);
} else {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
} catch (CommandLineException cfe) {
throw new IllegalArgumentException("Error handling command: "
+ cliCommand, cfe);
} catch (IOException ioe) {
throw new IllegalStateException("Unable to send command "
+ cliCommand + " to server.", ioe);
}
}
|
[
"public",
"Result",
"cmd",
"(",
"String",
"cliCommand",
")",
"{",
"try",
"{",
"// The intent here is to return a Response when this is doable.",
"if",
"(",
"ctx",
".",
"isWorkflowMode",
"(",
")",
"||",
"ctx",
".",
"isBatchMode",
"(",
")",
")",
"{",
"ctx",
".",
"handle",
"(",
"cliCommand",
")",
";",
"return",
"new",
"Result",
"(",
"cliCommand",
",",
"ctx",
".",
"getExitCode",
"(",
")",
")",
";",
"}",
"handler",
".",
"parse",
"(",
"ctx",
".",
"getCurrentNodePath",
"(",
")",
",",
"cliCommand",
",",
"ctx",
")",
";",
"if",
"(",
"handler",
".",
"getFormat",
"(",
")",
"==",
"OperationFormat",
".",
"INSTANCE",
")",
"{",
"ModelNode",
"request",
"=",
"ctx",
".",
"buildRequest",
"(",
"cliCommand",
")",
";",
"ModelNode",
"response",
"=",
"ctx",
".",
"execute",
"(",
"request",
",",
"cliCommand",
")",
";",
"return",
"new",
"Result",
"(",
"cliCommand",
",",
"request",
",",
"response",
")",
";",
"}",
"else",
"{",
"ctx",
".",
"handle",
"(",
"cliCommand",
")",
";",
"return",
"new",
"Result",
"(",
"cliCommand",
",",
"ctx",
".",
"getExitCode",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"CommandLineException",
"cfe",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Error handling command: \"",
"+",
"cliCommand",
",",
"cfe",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unable to send command \"",
"+",
"cliCommand",
"+",
"\" to server.\"",
",",
"ioe",
")",
";",
"}",
"}"
] |
Execute a CLI command. This can be any command that you might execute on
the CLI command line, including both server-side operations and local
commands such as 'cd' or 'cn'.
@param cliCommand A CLI command.
@return A result object that provides all information about the execution
of the command.
|
[
"Execute",
"a",
"CLI",
"command",
".",
"This",
"can",
"be",
"any",
"command",
"that",
"you",
"might",
"execute",
"on",
"the",
"CLI",
"command",
"line",
"including",
"both",
"server",
"-",
"side",
"operations",
"and",
"local",
"commands",
"such",
"as",
"cd",
"or",
"cn",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java#L231-L254
|
158,762 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/AbstractControllerService.java
|
AbstractControllerService.boot
|
protected void boot(final BootContext context) throws ConfigurationPersistenceException {
List<ModelNode> bootOps = configurationPersister.load();
ModelNode op = registerModelControllerServiceInitializationBootStep(context);
if (op != null) {
bootOps.add(op);
}
boot(bootOps, false);
finishBoot();
}
|
java
|
protected void boot(final BootContext context) throws ConfigurationPersistenceException {
List<ModelNode> bootOps = configurationPersister.load();
ModelNode op = registerModelControllerServiceInitializationBootStep(context);
if (op != null) {
bootOps.add(op);
}
boot(bootOps, false);
finishBoot();
}
|
[
"protected",
"void",
"boot",
"(",
"final",
"BootContext",
"context",
")",
"throws",
"ConfigurationPersistenceException",
"{",
"List",
"<",
"ModelNode",
">",
"bootOps",
"=",
"configurationPersister",
".",
"load",
"(",
")",
";",
"ModelNode",
"op",
"=",
"registerModelControllerServiceInitializationBootStep",
"(",
"context",
")",
";",
"if",
"(",
"op",
"!=",
"null",
")",
"{",
"bootOps",
".",
"add",
"(",
"op",
")",
";",
"}",
"boot",
"(",
"bootOps",
",",
"false",
")",
";",
"finishBoot",
"(",
")",
";",
"}"
] |
Boot the controller. Called during service start.
@param context the boot context
@throws ConfigurationPersistenceException
if the configuration failed to be loaded
|
[
"Boot",
"the",
"controller",
".",
"Called",
"during",
"service",
"start",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractControllerService.java#L415-L423
|
158,763 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/AbstractControllerService.java
|
AbstractControllerService.boot
|
protected boolean boot(List<ModelNode> bootOperations, boolean rollbackOnRuntimeFailure) throws ConfigurationPersistenceException {
return boot(bootOperations, rollbackOnRuntimeFailure, false, ModelControllerImpl.getMutableRootResourceRegistrationProvider());
}
|
java
|
protected boolean boot(List<ModelNode> bootOperations, boolean rollbackOnRuntimeFailure) throws ConfigurationPersistenceException {
return boot(bootOperations, rollbackOnRuntimeFailure, false, ModelControllerImpl.getMutableRootResourceRegistrationProvider());
}
|
[
"protected",
"boolean",
"boot",
"(",
"List",
"<",
"ModelNode",
">",
"bootOperations",
",",
"boolean",
"rollbackOnRuntimeFailure",
")",
"throws",
"ConfigurationPersistenceException",
"{",
"return",
"boot",
"(",
"bootOperations",
",",
"rollbackOnRuntimeFailure",
",",
"false",
",",
"ModelControllerImpl",
".",
"getMutableRootResourceRegistrationProvider",
"(",
")",
")",
";",
"}"
] |
Boot with the given operations, performing full model and capability registry validation.
@param bootOperations the operations. Cannot be {@code null}
@param rollbackOnRuntimeFailure {@code true} if the boot should fail if operations fail in the runtime stage
@return {@code true} if boot was successful
@throws ConfigurationPersistenceException
|
[
"Boot",
"with",
"the",
"given",
"operations",
"performing",
"full",
"model",
"and",
"capability",
"registry",
"validation",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractControllerService.java#L433-L435
|
158,764 |
wildfly/wildfly-core
|
launcher/src/main/java/org/wildfly/core/launcher/logger/Messages.java
|
Messages.getBundle
|
public static <T> T getBundle(final Class<T> type) {
return doPrivileged(new PrivilegedAction<T>() {
public T run() {
final Locale locale = Locale.getDefault();
final String lang = locale.getLanguage();
final String country = locale.getCountry();
final String variant = locale.getVariant();
Class<? extends T> bundleClass = null;
if (variant != null && !variant.isEmpty()) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", lang, country, variant), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null && country != null && !country.isEmpty()) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", lang, country, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null && lang != null && !lang.isEmpty()) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", lang, null, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", null, null, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Invalid bundle " + type + " (implementation not found)");
}
final Field field;
try {
field = bundleClass.getField("INSTANCE");
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Bundle implementation " + bundleClass + " has no instance field");
}
try {
return type.cast(field.get(null));
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Bundle implementation " + bundleClass + " could not be instantiated", e);
}
}
});
}
|
java
|
public static <T> T getBundle(final Class<T> type) {
return doPrivileged(new PrivilegedAction<T>() {
public T run() {
final Locale locale = Locale.getDefault();
final String lang = locale.getLanguage();
final String country = locale.getCountry();
final String variant = locale.getVariant();
Class<? extends T> bundleClass = null;
if (variant != null && !variant.isEmpty()) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", lang, country, variant), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null && country != null && !country.isEmpty()) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", lang, country, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null && lang != null && !lang.isEmpty()) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", lang, null, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
// ignore
}
if (bundleClass == null) try {
bundleClass = Class.forName(join(type.getName(), "$bundle", null, null, null), true, type.getClassLoader()).asSubclass(type);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException("Invalid bundle " + type + " (implementation not found)");
}
final Field field;
try {
field = bundleClass.getField("INSTANCE");
} catch (NoSuchFieldException e) {
throw new IllegalArgumentException("Bundle implementation " + bundleClass + " has no instance field");
}
try {
return type.cast(field.get(null));
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Bundle implementation " + bundleClass + " could not be instantiated", e);
}
}
});
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"getBundle",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"T",
">",
"(",
")",
"{",
"public",
"T",
"run",
"(",
")",
"{",
"final",
"Locale",
"locale",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"final",
"String",
"lang",
"=",
"locale",
".",
"getLanguage",
"(",
")",
";",
"final",
"String",
"country",
"=",
"locale",
".",
"getCountry",
"(",
")",
";",
"final",
"String",
"variant",
"=",
"locale",
".",
"getVariant",
"(",
")",
";",
"Class",
"<",
"?",
"extends",
"T",
">",
"bundleClass",
"=",
"null",
";",
"if",
"(",
"variant",
"!=",
"null",
"&&",
"!",
"variant",
".",
"isEmpty",
"(",
")",
")",
"try",
"{",
"bundleClass",
"=",
"Class",
".",
"forName",
"(",
"join",
"(",
"type",
".",
"getName",
"(",
")",
",",
"\"$bundle\"",
",",
"lang",
",",
"country",
",",
"variant",
")",
",",
"true",
",",
"type",
".",
"getClassLoader",
"(",
")",
")",
".",
"asSubclass",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"// ignore",
"}",
"if",
"(",
"bundleClass",
"==",
"null",
"&&",
"country",
"!=",
"null",
"&&",
"!",
"country",
".",
"isEmpty",
"(",
")",
")",
"try",
"{",
"bundleClass",
"=",
"Class",
".",
"forName",
"(",
"join",
"(",
"type",
".",
"getName",
"(",
")",
",",
"\"$bundle\"",
",",
"lang",
",",
"country",
",",
"null",
")",
",",
"true",
",",
"type",
".",
"getClassLoader",
"(",
")",
")",
".",
"asSubclass",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"// ignore",
"}",
"if",
"(",
"bundleClass",
"==",
"null",
"&&",
"lang",
"!=",
"null",
"&&",
"!",
"lang",
".",
"isEmpty",
"(",
")",
")",
"try",
"{",
"bundleClass",
"=",
"Class",
".",
"forName",
"(",
"join",
"(",
"type",
".",
"getName",
"(",
")",
",",
"\"$bundle\"",
",",
"lang",
",",
"null",
",",
"null",
")",
",",
"true",
",",
"type",
".",
"getClassLoader",
"(",
")",
")",
".",
"asSubclass",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"// ignore",
"}",
"if",
"(",
"bundleClass",
"==",
"null",
")",
"try",
"{",
"bundleClass",
"=",
"Class",
".",
"forName",
"(",
"join",
"(",
"type",
".",
"getName",
"(",
")",
",",
"\"$bundle\"",
",",
"null",
",",
"null",
",",
"null",
")",
",",
"true",
",",
"type",
".",
"getClassLoader",
"(",
")",
")",
".",
"asSubclass",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid bundle \"",
"+",
"type",
"+",
"\" (implementation not found)\"",
")",
";",
"}",
"final",
"Field",
"field",
";",
"try",
"{",
"field",
"=",
"bundleClass",
".",
"getField",
"(",
"\"INSTANCE\"",
")",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Bundle implementation \"",
"+",
"bundleClass",
"+",
"\" has no instance field\"",
")",
";",
"}",
"try",
"{",
"return",
"type",
".",
"cast",
"(",
"field",
".",
"get",
"(",
"null",
")",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Bundle implementation \"",
"+",
"bundleClass",
"+",
"\" could not be instantiated\"",
",",
"e",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] |
Get a message bundle of the given type.
@param type the bundle type class
@return the bundle
|
[
"Get",
"a",
"message",
"bundle",
"of",
"the",
"given",
"type",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/logger/Messages.java#L49-L91
|
158,765 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/access/Caller.java
|
Caller.getName
|
public String getName() {
if (name == null && securityIdentity != null) {
name = securityIdentity.getPrincipal().getName();
}
return name;
}
|
java
|
public String getName() {
if (name == null && securityIdentity != null) {
name = securityIdentity.getPrincipal().getName();
}
return name;
}
|
[
"public",
"String",
"getName",
"(",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"&&",
"securityIdentity",
"!=",
"null",
")",
"{",
"name",
"=",
"securityIdentity",
".",
"getPrincipal",
"(",
")",
".",
"getName",
"(",
")",
";",
"}",
"return",
"name",
";",
"}"
] |
Obtain the name of the caller, most likely a user but could also be a remote process.
@return The name of the caller.
|
[
"Obtain",
"the",
"name",
"of",
"the",
"caller",
"most",
"likely",
"a",
"user",
"but",
"could",
"also",
"be",
"a",
"remote",
"process",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/access/Caller.java#L72-L78
|
158,766 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/access/Caller.java
|
Caller.getRealm
|
public String getRealm() {
if (UNDEFINED.equals(realm)) {
Principal principal = securityIdentity.getPrincipal();
String realm = null;
if (principal instanceof RealmPrincipal) {
realm = ((RealmPrincipal)principal).getRealm();
}
this.realm = realm;
}
return this.realm;
}
|
java
|
public String getRealm() {
if (UNDEFINED.equals(realm)) {
Principal principal = securityIdentity.getPrincipal();
String realm = null;
if (principal instanceof RealmPrincipal) {
realm = ((RealmPrincipal)principal).getRealm();
}
this.realm = realm;
}
return this.realm;
}
|
[
"public",
"String",
"getRealm",
"(",
")",
"{",
"if",
"(",
"UNDEFINED",
".",
"equals",
"(",
"realm",
")",
")",
"{",
"Principal",
"principal",
"=",
"securityIdentity",
".",
"getPrincipal",
"(",
")",
";",
"String",
"realm",
"=",
"null",
";",
"if",
"(",
"principal",
"instanceof",
"RealmPrincipal",
")",
"{",
"realm",
"=",
"(",
"(",
"RealmPrincipal",
")",
"principal",
")",
".",
"getRealm",
"(",
")",
";",
"}",
"this",
".",
"realm",
"=",
"realm",
";",
"}",
"return",
"this",
".",
"realm",
";",
"}"
] |
Obtain the realm used for authentication.
This realm name applies to both the user and the groups.
@return The name of the realm used for authentication.
|
[
"Obtain",
"the",
"realm",
"used",
"for",
"authentication",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/access/Caller.java#L87-L99
|
158,767 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java
|
RemoteDomainConnectionService.resolveSubsystems
|
private ModelNode resolveSubsystems(final List<ModelNode> extensions) {
HostControllerLogger.ROOT_LOGGER.debug("Applying extensions provided by master");
final ModelNode result = operationExecutor.installSlaveExtensions(extensions);
if (!SUCCESS.equals(result.get(OUTCOME).asString())) {
throw HostControllerLogger.ROOT_LOGGER.failedToAddExtensions(result.get(FAILURE_DESCRIPTION));
}
final ModelNode subsystems = new ModelNode();
for (final ModelNode extension : extensions) {
extensionRegistry.recordSubsystemVersions(extension.asString(), subsystems);
}
return subsystems;
}
|
java
|
private ModelNode resolveSubsystems(final List<ModelNode> extensions) {
HostControllerLogger.ROOT_LOGGER.debug("Applying extensions provided by master");
final ModelNode result = operationExecutor.installSlaveExtensions(extensions);
if (!SUCCESS.equals(result.get(OUTCOME).asString())) {
throw HostControllerLogger.ROOT_LOGGER.failedToAddExtensions(result.get(FAILURE_DESCRIPTION));
}
final ModelNode subsystems = new ModelNode();
for (final ModelNode extension : extensions) {
extensionRegistry.recordSubsystemVersions(extension.asString(), subsystems);
}
return subsystems;
}
|
[
"private",
"ModelNode",
"resolveSubsystems",
"(",
"final",
"List",
"<",
"ModelNode",
">",
"extensions",
")",
"{",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"debug",
"(",
"\"Applying extensions provided by master\"",
")",
";",
"final",
"ModelNode",
"result",
"=",
"operationExecutor",
".",
"installSlaveExtensions",
"(",
"extensions",
")",
";",
"if",
"(",
"!",
"SUCCESS",
".",
"equals",
"(",
"result",
".",
"get",
"(",
"OUTCOME",
")",
".",
"asString",
"(",
")",
")",
")",
"{",
"throw",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"failedToAddExtensions",
"(",
"result",
".",
"get",
"(",
"FAILURE_DESCRIPTION",
")",
")",
";",
"}",
"final",
"ModelNode",
"subsystems",
"=",
"new",
"ModelNode",
"(",
")",
";",
"for",
"(",
"final",
"ModelNode",
"extension",
":",
"extensions",
")",
"{",
"extensionRegistry",
".",
"recordSubsystemVersions",
"(",
"extension",
".",
"asString",
"(",
")",
",",
"subsystems",
")",
";",
"}",
"return",
"subsystems",
";",
"}"
] |
Resolve the subsystem versions.
@param extensions the extensions to install
@return the subsystem versions
|
[
"Resolve",
"the",
"subsystem",
"versions",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java#L572-L584
|
158,768 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java
|
RemoteDomainConnectionService.applyRemoteDomainModel
|
private boolean applyRemoteDomainModel(final List<ModelNode> bootOperations, final HostInfo hostInfo) {
try {
HostControllerLogger.ROOT_LOGGER.debug("Applying domain level boot operations provided by master");
SyncModelParameters parameters =
new SyncModelParameters(domainController, ignoredDomainResourceRegistry,
hostControllerEnvironment, extensionRegistry, operationExecutor, true, serverProxies, remoteFileRepository, contentRepository);
final SyncDomainModelOperationHandler handler =
new SyncDomainModelOperationHandler(hostInfo, parameters);
final ModelNode operation = APPLY_DOMAIN_MODEL.clone();
operation.get(DOMAIN_MODEL).set(bootOperations);
final ModelNode result = operationExecutor.execute(OperationBuilder.create(operation).build(), OperationMessageHandler.DISCARD, ModelController.OperationTransactionControl.COMMIT, handler);
final String outcome = result.get(OUTCOME).asString();
final boolean success = SUCCESS.equals(outcome);
// check if anything we synced triggered reload-required or restart-required.
// if they did we log a warning on the synced slave.
if (result.has(RESPONSE_HEADERS)) {
final ModelNode headers = result.get(RESPONSE_HEADERS);
if (headers.hasDefined(OPERATION_REQUIRES_RELOAD) && headers.get(OPERATION_REQUIRES_RELOAD).asBoolean()) {
HostControllerLogger.ROOT_LOGGER.domainModelAppliedButReloadIsRequired();
}
if (headers.hasDefined(OPERATION_REQUIRES_RESTART) && headers.get(OPERATION_REQUIRES_RESTART).asBoolean()) {
HostControllerLogger.ROOT_LOGGER.domainModelAppliedButRestartIsRequired();
}
}
if (!success) {
ModelNode failureDesc = result.hasDefined(FAILURE_DESCRIPTION) ? result.get(FAILURE_DESCRIPTION) : new ModelNode();
HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(outcome, failureDesc);
return false;
} else {
return true;
}
} catch (Exception e) {
HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(e);
return false;
}
}
|
java
|
private boolean applyRemoteDomainModel(final List<ModelNode> bootOperations, final HostInfo hostInfo) {
try {
HostControllerLogger.ROOT_LOGGER.debug("Applying domain level boot operations provided by master");
SyncModelParameters parameters =
new SyncModelParameters(domainController, ignoredDomainResourceRegistry,
hostControllerEnvironment, extensionRegistry, operationExecutor, true, serverProxies, remoteFileRepository, contentRepository);
final SyncDomainModelOperationHandler handler =
new SyncDomainModelOperationHandler(hostInfo, parameters);
final ModelNode operation = APPLY_DOMAIN_MODEL.clone();
operation.get(DOMAIN_MODEL).set(bootOperations);
final ModelNode result = operationExecutor.execute(OperationBuilder.create(operation).build(), OperationMessageHandler.DISCARD, ModelController.OperationTransactionControl.COMMIT, handler);
final String outcome = result.get(OUTCOME).asString();
final boolean success = SUCCESS.equals(outcome);
// check if anything we synced triggered reload-required or restart-required.
// if they did we log a warning on the synced slave.
if (result.has(RESPONSE_HEADERS)) {
final ModelNode headers = result.get(RESPONSE_HEADERS);
if (headers.hasDefined(OPERATION_REQUIRES_RELOAD) && headers.get(OPERATION_REQUIRES_RELOAD).asBoolean()) {
HostControllerLogger.ROOT_LOGGER.domainModelAppliedButReloadIsRequired();
}
if (headers.hasDefined(OPERATION_REQUIRES_RESTART) && headers.get(OPERATION_REQUIRES_RESTART).asBoolean()) {
HostControllerLogger.ROOT_LOGGER.domainModelAppliedButRestartIsRequired();
}
}
if (!success) {
ModelNode failureDesc = result.hasDefined(FAILURE_DESCRIPTION) ? result.get(FAILURE_DESCRIPTION) : new ModelNode();
HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(outcome, failureDesc);
return false;
} else {
return true;
}
} catch (Exception e) {
HostControllerLogger.ROOT_LOGGER.failedToApplyDomainConfig(e);
return false;
}
}
|
[
"private",
"boolean",
"applyRemoteDomainModel",
"(",
"final",
"List",
"<",
"ModelNode",
">",
"bootOperations",
",",
"final",
"HostInfo",
"hostInfo",
")",
"{",
"try",
"{",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"debug",
"(",
"\"Applying domain level boot operations provided by master\"",
")",
";",
"SyncModelParameters",
"parameters",
"=",
"new",
"SyncModelParameters",
"(",
"domainController",
",",
"ignoredDomainResourceRegistry",
",",
"hostControllerEnvironment",
",",
"extensionRegistry",
",",
"operationExecutor",
",",
"true",
",",
"serverProxies",
",",
"remoteFileRepository",
",",
"contentRepository",
")",
";",
"final",
"SyncDomainModelOperationHandler",
"handler",
"=",
"new",
"SyncDomainModelOperationHandler",
"(",
"hostInfo",
",",
"parameters",
")",
";",
"final",
"ModelNode",
"operation",
"=",
"APPLY_DOMAIN_MODEL",
".",
"clone",
"(",
")",
";",
"operation",
".",
"get",
"(",
"DOMAIN_MODEL",
")",
".",
"set",
"(",
"bootOperations",
")",
";",
"final",
"ModelNode",
"result",
"=",
"operationExecutor",
".",
"execute",
"(",
"OperationBuilder",
".",
"create",
"(",
"operation",
")",
".",
"build",
"(",
")",
",",
"OperationMessageHandler",
".",
"DISCARD",
",",
"ModelController",
".",
"OperationTransactionControl",
".",
"COMMIT",
",",
"handler",
")",
";",
"final",
"String",
"outcome",
"=",
"result",
".",
"get",
"(",
"OUTCOME",
")",
".",
"asString",
"(",
")",
";",
"final",
"boolean",
"success",
"=",
"SUCCESS",
".",
"equals",
"(",
"outcome",
")",
";",
"// check if anything we synced triggered reload-required or restart-required.",
"// if they did we log a warning on the synced slave.",
"if",
"(",
"result",
".",
"has",
"(",
"RESPONSE_HEADERS",
")",
")",
"{",
"final",
"ModelNode",
"headers",
"=",
"result",
".",
"get",
"(",
"RESPONSE_HEADERS",
")",
";",
"if",
"(",
"headers",
".",
"hasDefined",
"(",
"OPERATION_REQUIRES_RELOAD",
")",
"&&",
"headers",
".",
"get",
"(",
"OPERATION_REQUIRES_RELOAD",
")",
".",
"asBoolean",
"(",
")",
")",
"{",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"domainModelAppliedButReloadIsRequired",
"(",
")",
";",
"}",
"if",
"(",
"headers",
".",
"hasDefined",
"(",
"OPERATION_REQUIRES_RESTART",
")",
"&&",
"headers",
".",
"get",
"(",
"OPERATION_REQUIRES_RESTART",
")",
".",
"asBoolean",
"(",
")",
")",
"{",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"domainModelAppliedButRestartIsRequired",
"(",
")",
";",
"}",
"}",
"if",
"(",
"!",
"success",
")",
"{",
"ModelNode",
"failureDesc",
"=",
"result",
".",
"hasDefined",
"(",
"FAILURE_DESCRIPTION",
")",
"?",
"result",
".",
"get",
"(",
"FAILURE_DESCRIPTION",
")",
":",
"new",
"ModelNode",
"(",
")",
";",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"failedToApplyDomainConfig",
"(",
"outcome",
",",
"failureDesc",
")",
";",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"failedToApplyDomainConfig",
"(",
"e",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Apply the remote domain model to the local host controller.
@param bootOperations the result of the remote read-domain-model op
@return {@code true} if the model was applied successfully, {@code false} otherwise
|
[
"Apply",
"the",
"remote",
"domain",
"model",
"to",
"the",
"local",
"host",
"controller",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java#L592-L630
|
158,769 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java
|
RemoteDomainConnectionService.rethrowIrrecoverableConnectionFailures
|
static void rethrowIrrecoverableConnectionFailures(IOException e) throws SlaveRegistrationException {
Throwable cause = e;
while ((cause = cause.getCause()) != null) {
if (cause instanceof SaslException) {
throw HostControllerLogger.ROOT_LOGGER.authenticationFailureUnableToConnect(cause);
} else if (cause instanceof SSLHandshakeException) {
throw HostControllerLogger.ROOT_LOGGER.sslFailureUnableToConnect(cause);
} else if (cause instanceof SlaveRegistrationException) {
throw (SlaveRegistrationException) cause;
}
}
}
|
java
|
static void rethrowIrrecoverableConnectionFailures(IOException e) throws SlaveRegistrationException {
Throwable cause = e;
while ((cause = cause.getCause()) != null) {
if (cause instanceof SaslException) {
throw HostControllerLogger.ROOT_LOGGER.authenticationFailureUnableToConnect(cause);
} else if (cause instanceof SSLHandshakeException) {
throw HostControllerLogger.ROOT_LOGGER.sslFailureUnableToConnect(cause);
} else if (cause instanceof SlaveRegistrationException) {
throw (SlaveRegistrationException) cause;
}
}
}
|
[
"static",
"void",
"rethrowIrrecoverableConnectionFailures",
"(",
"IOException",
"e",
")",
"throws",
"SlaveRegistrationException",
"{",
"Throwable",
"cause",
"=",
"e",
";",
"while",
"(",
"(",
"cause",
"=",
"cause",
".",
"getCause",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"cause",
"instanceof",
"SaslException",
")",
"{",
"throw",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"authenticationFailureUnableToConnect",
"(",
"cause",
")",
";",
"}",
"else",
"if",
"(",
"cause",
"instanceof",
"SSLHandshakeException",
")",
"{",
"throw",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"sslFailureUnableToConnect",
"(",
"cause",
")",
";",
"}",
"else",
"if",
"(",
"cause",
"instanceof",
"SlaveRegistrationException",
")",
"{",
"throw",
"(",
"SlaveRegistrationException",
")",
"cause",
";",
"}",
"}",
"}"
] |
Analyzes a failure thrown connecting to the master for causes that indicate
some problem not likely to be resolved by immediately retrying. If found,
throws an exception highlighting the underlying cause. If the cause is not
one of the ones understood by this method, the method returns normally.
@throws org.jboss.as.domain.controller.SlaveRegistrationException if the remote HC rejected the request
@throws IllegalStateException for other failures understood by this method
|
[
"Analyzes",
"a",
"failure",
"thrown",
"connecting",
"to",
"the",
"master",
"for",
"causes",
"that",
"indicate",
"some",
"problem",
"not",
"likely",
"to",
"be",
"resolved",
"by",
"immediately",
"retrying",
".",
"If",
"found",
"throws",
"an",
"exception",
"highlighting",
"the",
"underlying",
"cause",
".",
"If",
"the",
"cause",
"is",
"not",
"one",
"of",
"the",
"ones",
"understood",
"by",
"this",
"method",
"the",
"method",
"returns",
"normally",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java#L670-L681
|
158,770 |
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java
|
RemoteDomainConnectionService.logConnectionException
|
static void logConnectionException(URI uri, DiscoveryOption discoveryOption, boolean moreOptions, Exception e) {
if (uri == null) {
HostControllerLogger.ROOT_LOGGER.failedDiscoveringMaster(discoveryOption, e);
} else {
HostControllerLogger.ROOT_LOGGER.cannotConnect(uri, e);
}
if (!moreOptions) {
// All discovery options have been exhausted
HostControllerLogger.ROOT_LOGGER.noDiscoveryOptionsLeft();
}
}
|
java
|
static void logConnectionException(URI uri, DiscoveryOption discoveryOption, boolean moreOptions, Exception e) {
if (uri == null) {
HostControllerLogger.ROOT_LOGGER.failedDiscoveringMaster(discoveryOption, e);
} else {
HostControllerLogger.ROOT_LOGGER.cannotConnect(uri, e);
}
if (!moreOptions) {
// All discovery options have been exhausted
HostControllerLogger.ROOT_LOGGER.noDiscoveryOptionsLeft();
}
}
|
[
"static",
"void",
"logConnectionException",
"(",
"URI",
"uri",
",",
"DiscoveryOption",
"discoveryOption",
",",
"boolean",
"moreOptions",
",",
"Exception",
"e",
")",
"{",
"if",
"(",
"uri",
"==",
"null",
")",
"{",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"failedDiscoveringMaster",
"(",
"discoveryOption",
",",
"e",
")",
";",
"}",
"else",
"{",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"cannotConnect",
"(",
"uri",
",",
"e",
")",
";",
"}",
"if",
"(",
"!",
"moreOptions",
")",
"{",
"// All discovery options have been exhausted",
"HostControllerLogger",
".",
"ROOT_LOGGER",
".",
"noDiscoveryOptionsLeft",
"(",
")",
";",
"}",
"}"
] |
Handles logging tasks related to a failure to connect to a remote HC.
@param uri the URI at which the connection attempt was made. Can be {@code null} indicating a failure to discover the HC
@param discoveryOption the {@code DiscoveryOption} used to determine {@code uri}
@param moreOptions {@code true} if there are more untried discovery options
@param e the exception
|
[
"Handles",
"logging",
"tasks",
"related",
"to",
"a",
"failure",
"to",
"connect",
"to",
"a",
"remote",
"HC",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java#L690-L700
|
158,771 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/AliasOperationTransformer.java
|
AliasOperationTransformer.replaceLastElement
|
public static AliasOperationTransformer replaceLastElement(final PathElement element) {
return create(new AddressTransformer() {
@Override
public PathAddress transformAddress(final PathAddress original) {
final PathAddress address = original.subAddress(0, original.size() -1);
return address.append(element);
}
});
}
|
java
|
public static AliasOperationTransformer replaceLastElement(final PathElement element) {
return create(new AddressTransformer() {
@Override
public PathAddress transformAddress(final PathAddress original) {
final PathAddress address = original.subAddress(0, original.size() -1);
return address.append(element);
}
});
}
|
[
"public",
"static",
"AliasOperationTransformer",
"replaceLastElement",
"(",
"final",
"PathElement",
"element",
")",
"{",
"return",
"create",
"(",
"new",
"AddressTransformer",
"(",
")",
"{",
"@",
"Override",
"public",
"PathAddress",
"transformAddress",
"(",
"final",
"PathAddress",
"original",
")",
"{",
"final",
"PathAddress",
"address",
"=",
"original",
".",
"subAddress",
"(",
"0",
",",
"original",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"return",
"address",
".",
"append",
"(",
"element",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Replace the last element of an address with a static path element.
@param element the path element
@return the operation address transformer
|
[
"Replace",
"the",
"last",
"element",
"of",
"an",
"address",
"with",
"a",
"static",
"path",
"element",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/AliasOperationTransformer.java#L91-L99
|
158,772 |
wildfly/wildfly-core
|
domain-management/src/main/java/org/jboss/as/domain/management/security/adduser/UpdatePropertiesHandler.java
|
UpdatePropertiesHandler.persist
|
void persist(final String key, final String value, final boolean enableDisableMode, final boolean disable, final File file) throws IOException, StartException {
persist(key, value, enableDisableMode, disable, file, null);
}
|
java
|
void persist(final String key, final String value, final boolean enableDisableMode, final boolean disable, final File file) throws IOException, StartException {
persist(key, value, enableDisableMode, disable, file, null);
}
|
[
"void",
"persist",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
",",
"final",
"boolean",
"enableDisableMode",
",",
"final",
"boolean",
"disable",
",",
"final",
"File",
"file",
")",
"throws",
"IOException",
",",
"StartException",
"{",
"persist",
"(",
"key",
",",
"value",
",",
"enableDisableMode",
",",
"disable",
",",
"file",
",",
"null",
")",
";",
"}"
] |
Implement the persistence handler for storing the group properties.
|
[
"Implement",
"the",
"persistence",
"handler",
"for",
"storing",
"the",
"group",
"properties",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/adduser/UpdatePropertiesHandler.java#L49-L51
|
158,773 |
wildfly/wildfly-core
|
domain-management/src/main/java/org/jboss/as/domain/management/security/adduser/UpdatePropertiesHandler.java
|
UpdatePropertiesHandler.persist
|
void persist(final String key, final String value, final boolean enableDisableMode, final boolean disable, final File file, final String realm) throws IOException, StartException {
final PropertiesFileLoader propertiesHandler = realm == null ? new PropertiesFileLoader(file.getAbsolutePath(), null) :
new UserPropertiesFileLoader(file.getAbsolutePath(), null);
try {
propertiesHandler.start(null);
if (realm != null) {
((UserPropertiesFileLoader) propertiesHandler).setRealmName(realm);
}
Properties prob = propertiesHandler.getProperties();
if (value != null) {
prob.setProperty(key, value);
}
if (enableDisableMode) {
prob.setProperty(key + "!disable", String.valueOf(disable));
}
propertiesHandler.persistProperties();
} finally {
propertiesHandler.stop(null);
}
}
|
java
|
void persist(final String key, final String value, final boolean enableDisableMode, final boolean disable, final File file, final String realm) throws IOException, StartException {
final PropertiesFileLoader propertiesHandler = realm == null ? new PropertiesFileLoader(file.getAbsolutePath(), null) :
new UserPropertiesFileLoader(file.getAbsolutePath(), null);
try {
propertiesHandler.start(null);
if (realm != null) {
((UserPropertiesFileLoader) propertiesHandler).setRealmName(realm);
}
Properties prob = propertiesHandler.getProperties();
if (value != null) {
prob.setProperty(key, value);
}
if (enableDisableMode) {
prob.setProperty(key + "!disable", String.valueOf(disable));
}
propertiesHandler.persistProperties();
} finally {
propertiesHandler.stop(null);
}
}
|
[
"void",
"persist",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
",",
"final",
"boolean",
"enableDisableMode",
",",
"final",
"boolean",
"disable",
",",
"final",
"File",
"file",
",",
"final",
"String",
"realm",
")",
"throws",
"IOException",
",",
"StartException",
"{",
"final",
"PropertiesFileLoader",
"propertiesHandler",
"=",
"realm",
"==",
"null",
"?",
"new",
"PropertiesFileLoader",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
",",
"null",
")",
":",
"new",
"UserPropertiesFileLoader",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
",",
"null",
")",
";",
"try",
"{",
"propertiesHandler",
".",
"start",
"(",
"null",
")",
";",
"if",
"(",
"realm",
"!=",
"null",
")",
"{",
"(",
"(",
"UserPropertiesFileLoader",
")",
"propertiesHandler",
")",
".",
"setRealmName",
"(",
"realm",
")",
";",
"}",
"Properties",
"prob",
"=",
"propertiesHandler",
".",
"getProperties",
"(",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"prob",
".",
"setProperty",
"(",
"key",
",",
"value",
")",
";",
"}",
"if",
"(",
"enableDisableMode",
")",
"{",
"prob",
".",
"setProperty",
"(",
"key",
"+",
"\"!disable\"",
",",
"String",
".",
"valueOf",
"(",
"disable",
")",
")",
";",
"}",
"propertiesHandler",
".",
"persistProperties",
"(",
")",
";",
"}",
"finally",
"{",
"propertiesHandler",
".",
"stop",
"(",
"null",
")",
";",
"}",
"}"
] |
Implement the persistence handler for storing the user properties.
|
[
"Implement",
"the",
"persistence",
"handler",
"for",
"storing",
"the",
"user",
"properties",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/adduser/UpdatePropertiesHandler.java#L56-L75
|
158,774 |
wildfly/wildfly-core
|
server/src/main/java/org/jboss/as/server/deployment/Services.java
|
Services.deploymentUnitName
|
public static ServiceName deploymentUnitName(String name, Phase phase) {
return JBOSS_DEPLOYMENT_UNIT.append(name, phase.name());
}
|
java
|
public static ServiceName deploymentUnitName(String name, Phase phase) {
return JBOSS_DEPLOYMENT_UNIT.append(name, phase.name());
}
|
[
"public",
"static",
"ServiceName",
"deploymentUnitName",
"(",
"String",
"name",
",",
"Phase",
"phase",
")",
"{",
"return",
"JBOSS_DEPLOYMENT_UNIT",
".",
"append",
"(",
"name",
",",
"phase",
".",
"name",
"(",
")",
")",
";",
"}"
] |
Get the service name of a top-level deployment unit.
@param name the simple name of the deployment
@param phase the deployment phase
@return the service name
|
[
"Get",
"the",
"service",
"name",
"of",
"a",
"top",
"-",
"level",
"deployment",
"unit",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/Services.java#L83-L85
|
158,775 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/AbstractModelUpdateHandler.java
|
AbstractModelUpdateHandler.updateModel
|
protected void updateModel(final ModelNode operation, final Resource resource) throws OperationFailedException {
updateModel(operation, resource.getModel());
}
|
java
|
protected void updateModel(final ModelNode operation, final Resource resource) throws OperationFailedException {
updateModel(operation, resource.getModel());
}
|
[
"protected",
"void",
"updateModel",
"(",
"final",
"ModelNode",
"operation",
",",
"final",
"Resource",
"resource",
")",
"throws",
"OperationFailedException",
"{",
"updateModel",
"(",
"operation",
",",
"resource",
".",
"getModel",
"(",
")",
")",
";",
"}"
] |
Update the given resource in the persistent configuration model based on the values in the given operation.
@param operation the operation
@param resource the resource that corresponds to the address of {@code operation}
@throws OperationFailedException if {@code operation} is invalid or populating the model otherwise fails
|
[
"Update",
"the",
"given",
"resource",
"in",
"the",
"persistent",
"configuration",
"model",
"based",
"on",
"the",
"values",
"in",
"the",
"given",
"operation",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AbstractModelUpdateHandler.java#L64-L66
|
158,776 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.logAttributeWarning
|
public void logAttributeWarning(PathAddress address, String attribute) {
logAttributeWarning(address, null, null, attribute);
}
|
java
|
public void logAttributeWarning(PathAddress address, String attribute) {
logAttributeWarning(address, null, null, attribute);
}
|
[
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"String",
"attribute",
")",
"{",
"logAttributeWarning",
"(",
"address",
",",
"null",
",",
"null",
",",
"attribute",
")",
";",
"}"
] |
Log a warning for the resource at the provided address and a single attribute. The detail message is a default
'Attributes are not understood in the target model version and this resource will need to be ignored on the target host.'
@param address where warning occurred
@param attribute attribute we are warning about
|
[
"Log",
"a",
"warning",
"for",
"the",
"resource",
"at",
"the",
"provided",
"address",
"and",
"a",
"single",
"attribute",
".",
"The",
"detail",
"message",
"is",
"a",
"default",
"Attributes",
"are",
"not",
"understood",
"in",
"the",
"target",
"model",
"version",
"and",
"this",
"resource",
"will",
"need",
"to",
"be",
"ignored",
"on",
"the",
"target",
"host",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L98-L100
|
158,777 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.logAttributeWarning
|
public void logAttributeWarning(PathAddress address, Set<String> attributes) {
logAttributeWarning(address, null, null, attributes);
}
|
java
|
public void logAttributeWarning(PathAddress address, Set<String> attributes) {
logAttributeWarning(address, null, null, attributes);
}
|
[
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"Set",
"<",
"String",
">",
"attributes",
")",
"{",
"logAttributeWarning",
"(",
"address",
",",
"null",
",",
"null",
",",
"attributes",
")",
";",
"}"
] |
Log a warning for the resource at the provided address and the given attributes. The detail message is a default
'Attributes are not understood in the target model version and this resource will need to be ignored on the target host.'
@param address where warning occurred
@param attributes attributes we are warning about
|
[
"Log",
"a",
"warning",
"for",
"the",
"resource",
"at",
"the",
"provided",
"address",
"and",
"the",
"given",
"attributes",
".",
"The",
"detail",
"message",
"is",
"a",
"default",
"Attributes",
"are",
"not",
"understood",
"in",
"the",
"target",
"model",
"version",
"and",
"this",
"resource",
"will",
"need",
"to",
"be",
"ignored",
"on",
"the",
"target",
"host",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L109-L111
|
158,778 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.logAttributeWarning
|
public void logAttributeWarning(PathAddress address, String message, String attribute) {
logAttributeWarning(address, null, message, attribute);
}
|
java
|
public void logAttributeWarning(PathAddress address, String message, String attribute) {
logAttributeWarning(address, null, message, attribute);
}
|
[
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"String",
"message",
",",
"String",
"attribute",
")",
"{",
"logAttributeWarning",
"(",
"address",
",",
"null",
",",
"message",
",",
"attribute",
")",
";",
"}"
] |
Log warning for the resource at the provided address and single attribute, using the provided detail
message.
@param address where warning occurred
@param message custom error message to append
@param attribute attribute we are warning about
|
[
"Log",
"warning",
"for",
"the",
"resource",
"at",
"the",
"provided",
"address",
"and",
"single",
"attribute",
"using",
"the",
"provided",
"detail",
"message",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L121-L123
|
158,779 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.logAttributeWarning
|
public void logAttributeWarning(PathAddress address, String message, Set<String> attributes) {
messageQueue.add(new AttributeLogEntry(address, null, message, attributes));
}
|
java
|
public void logAttributeWarning(PathAddress address, String message, Set<String> attributes) {
messageQueue.add(new AttributeLogEntry(address, null, message, attributes));
}
|
[
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"String",
"message",
",",
"Set",
"<",
"String",
">",
"attributes",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"AttributeLogEntry",
"(",
"address",
",",
"null",
",",
"message",
",",
"attributes",
")",
")",
";",
"}"
] |
Log a warning for the resource at the provided address and the given attributes, using the provided detail
message.
@param address where warning occurred
@param message custom error message to append
@param attributes attributes we that have problems about
|
[
"Log",
"a",
"warning",
"for",
"the",
"resource",
"at",
"the",
"provided",
"address",
"and",
"the",
"given",
"attributes",
"using",
"the",
"provided",
"detail",
"message",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L133-L135
|
158,780 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.logAttributeWarning
|
public void logAttributeWarning(PathAddress address, ModelNode operation, String message, String attribute) {
messageQueue.add(new AttributeLogEntry(address, operation, message, attribute));
}
|
java
|
public void logAttributeWarning(PathAddress address, ModelNode operation, String message, String attribute) {
messageQueue.add(new AttributeLogEntry(address, operation, message, attribute));
}
|
[
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"ModelNode",
"operation",
",",
"String",
"message",
",",
"String",
"attribute",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"AttributeLogEntry",
"(",
"address",
",",
"operation",
",",
"message",
",",
"attribute",
")",
")",
";",
"}"
] |
Log a warning for the given operation at the provided address for the given attribute, using the provided detail
message.
@param address where warning occurred
@param operation where which problem occurred
@param message custom error message to append
@param attribute attribute we that has problem
|
[
"Log",
"a",
"warning",
"for",
"the",
"given",
"operation",
"at",
"the",
"provided",
"address",
"for",
"the",
"given",
"attribute",
"using",
"the",
"provided",
"detail",
"message",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L147-L149
|
158,781 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.logAttributeWarning
|
public void logAttributeWarning(PathAddress address, ModelNode operation, String message, Set<String> attributes) {
messageQueue.add(new AttributeLogEntry(address, operation, message, attributes));
}
|
java
|
public void logAttributeWarning(PathAddress address, ModelNode operation, String message, Set<String> attributes) {
messageQueue.add(new AttributeLogEntry(address, operation, message, attributes));
}
|
[
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"ModelNode",
"operation",
",",
"String",
"message",
",",
"Set",
"<",
"String",
">",
"attributes",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"AttributeLogEntry",
"(",
"address",
",",
"operation",
",",
"message",
",",
"attributes",
")",
")",
";",
"}"
] |
Log a warning for the given operation at the provided address for the given attributes, using the provided detail
message.
@param address where warning occurred
@param operation where which problem occurred
@param message custom error message to append
@param attributes attributes we that have problems about
|
[
"Log",
"a",
"warning",
"for",
"the",
"given",
"operation",
"at",
"the",
"provided",
"address",
"for",
"the",
"given",
"attributes",
"using",
"the",
"provided",
"detail",
"message",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L160-L162
|
158,782 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.logWarning
|
public void logWarning(final String message) {
messageQueue.add(new LogEntry() {
@Override
public String getMessage() {
return message;
}
});
}
|
java
|
public void logWarning(final String message) {
messageQueue.add(new LogEntry() {
@Override
public String getMessage() {
return message;
}
});
}
|
[
"public",
"void",
"logWarning",
"(",
"final",
"String",
"message",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"LogEntry",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"getMessage",
"(",
")",
"{",
"return",
"message",
";",
"}",
"}",
")",
";",
"}"
] |
Log a free-form warning
@param message the warning message. Cannot be {@code null}
|
[
"Log",
"a",
"free",
"-",
"form",
"warning"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L242-L249
|
158,783 |
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java
|
TransformersLogger.flushLogQueue
|
void flushLogQueue() {
Set<String> problems = new LinkedHashSet<String>();
synchronized (messageQueue) {
Iterator<LogEntry> i = messageQueue.iterator();
while (i.hasNext()) {
problems.add("\t\t" + i.next().getMessage() + "\n");
i.remove();
}
}
if (!problems.isEmpty()) {
logger.transformationWarnings(target.getHostName(), problems);
}
}
|
java
|
void flushLogQueue() {
Set<String> problems = new LinkedHashSet<String>();
synchronized (messageQueue) {
Iterator<LogEntry> i = messageQueue.iterator();
while (i.hasNext()) {
problems.add("\t\t" + i.next().getMessage() + "\n");
i.remove();
}
}
if (!problems.isEmpty()) {
logger.transformationWarnings(target.getHostName(), problems);
}
}
|
[
"void",
"flushLogQueue",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"problems",
"=",
"new",
"LinkedHashSet",
"<",
"String",
">",
"(",
")",
";",
"synchronized",
"(",
"messageQueue",
")",
"{",
"Iterator",
"<",
"LogEntry",
">",
"i",
"=",
"messageQueue",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"problems",
".",
"add",
"(",
"\"\\t\\t\"",
"+",
"i",
".",
"next",
"(",
")",
".",
"getMessage",
"(",
")",
"+",
"\"\\n\"",
")",
";",
"i",
".",
"remove",
"(",
")",
";",
"}",
"}",
"if",
"(",
"!",
"problems",
".",
"isEmpty",
"(",
")",
")",
"{",
"logger",
".",
"transformationWarnings",
"(",
"target",
".",
"getHostName",
"(",
")",
",",
"problems",
")",
";",
"}",
"}"
] |
flushes log queue, this actually writes combined log message into system log
|
[
"flushes",
"log",
"queue",
"this",
"actually",
"writes",
"combined",
"log",
"message",
"into",
"system",
"log"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L254-L266
|
158,784 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.getEntry
|
PatchEntry getEntry(final String name, boolean addOn) {
return addOn ? addOns.get(name) : layers.get(name);
}
|
java
|
PatchEntry getEntry(final String name, boolean addOn) {
return addOn ? addOns.get(name) : layers.get(name);
}
|
[
"PatchEntry",
"getEntry",
"(",
"final",
"String",
"name",
",",
"boolean",
"addOn",
")",
"{",
"return",
"addOn",
"?",
"addOns",
".",
"get",
"(",
"name",
")",
":",
"layers",
".",
"get",
"(",
"name",
")",
";",
"}"
] |
Get a patch entry for either a layer or add-on.
@param name the layer name
@param addOn whether the target is an add-on
@return the patch entry, {@code null} if it there is no such layer
|
[
"Get",
"a",
"patch",
"entry",
"for",
"either",
"a",
"layer",
"or",
"add",
"-",
"on",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L135-L137
|
158,785 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.failedToCleanupDir
|
protected void failedToCleanupDir(final File file) {
checkForGarbageOnRestart = true;
PatchLogger.ROOT_LOGGER.cannotDeleteFile(file.getAbsolutePath());
}
|
java
|
protected void failedToCleanupDir(final File file) {
checkForGarbageOnRestart = true;
PatchLogger.ROOT_LOGGER.cannotDeleteFile(file.getAbsolutePath());
}
|
[
"protected",
"void",
"failedToCleanupDir",
"(",
"final",
"File",
"file",
")",
"{",
"checkForGarbageOnRestart",
"=",
"true",
";",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"cannotDeleteFile",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}"
] |
In case we cannot delete a directory create a marker to recheck whether we can garbage collect some not
referenced directories and files.
@param file the directory
|
[
"In",
"case",
"we",
"cannot",
"delete",
"a",
"directory",
"create",
"a",
"marker",
"to",
"recheck",
"whether",
"we",
"can",
"garbage",
"collect",
"some",
"not",
"referenced",
"directories",
"and",
"files",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L190-L193
|
158,786 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.resolveForElement
|
protected PatchEntry resolveForElement(final PatchElement element) throws PatchingException {
assert state == State.NEW;
final PatchElementProvider provider = element.getProvider();
final String layerName = provider.getName();
final LayerType layerType = provider.getLayerType();
final Map<String, PatchEntry> map;
if (layerType == LayerType.Layer) {
map = layers;
} else {
map = addOns;
}
PatchEntry entry = map.get(layerName);
if (entry == null) {
final InstallationManager.MutablePatchingTarget target = modification.resolve(layerName, layerType);
if (target == null) {
throw PatchLogger.ROOT_LOGGER.noSuchLayer(layerName);
}
entry = new PatchEntry(target, element);
map.put(layerName, entry);
}
// Maintain the most recent element
entry.updateElement(element);
return entry;
}
|
java
|
protected PatchEntry resolveForElement(final PatchElement element) throws PatchingException {
assert state == State.NEW;
final PatchElementProvider provider = element.getProvider();
final String layerName = provider.getName();
final LayerType layerType = provider.getLayerType();
final Map<String, PatchEntry> map;
if (layerType == LayerType.Layer) {
map = layers;
} else {
map = addOns;
}
PatchEntry entry = map.get(layerName);
if (entry == null) {
final InstallationManager.MutablePatchingTarget target = modification.resolve(layerName, layerType);
if (target == null) {
throw PatchLogger.ROOT_LOGGER.noSuchLayer(layerName);
}
entry = new PatchEntry(target, element);
map.put(layerName, entry);
}
// Maintain the most recent element
entry.updateElement(element);
return entry;
}
|
[
"protected",
"PatchEntry",
"resolveForElement",
"(",
"final",
"PatchElement",
"element",
")",
"throws",
"PatchingException",
"{",
"assert",
"state",
"==",
"State",
".",
"NEW",
";",
"final",
"PatchElementProvider",
"provider",
"=",
"element",
".",
"getProvider",
"(",
")",
";",
"final",
"String",
"layerName",
"=",
"provider",
".",
"getName",
"(",
")",
";",
"final",
"LayerType",
"layerType",
"=",
"provider",
".",
"getLayerType",
"(",
")",
";",
"final",
"Map",
"<",
"String",
",",
"PatchEntry",
">",
"map",
";",
"if",
"(",
"layerType",
"==",
"LayerType",
".",
"Layer",
")",
"{",
"map",
"=",
"layers",
";",
"}",
"else",
"{",
"map",
"=",
"addOns",
";",
"}",
"PatchEntry",
"entry",
"=",
"map",
".",
"get",
"(",
"layerName",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"final",
"InstallationManager",
".",
"MutablePatchingTarget",
"target",
"=",
"modification",
".",
"resolve",
"(",
"layerName",
",",
"layerType",
")",
";",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"noSuchLayer",
"(",
"layerName",
")",
";",
"}",
"entry",
"=",
"new",
"PatchEntry",
"(",
"target",
",",
"element",
")",
";",
"map",
".",
"put",
"(",
"layerName",
",",
"entry",
")",
";",
"}",
"// Maintain the most recent element",
"entry",
".",
"updateElement",
"(",
"element",
")",
";",
"return",
"entry",
";",
"}"
] |
Get the target entry for a given patch element.
@param element the patch element
@return the patch entry
@throws PatchingException
|
[
"Get",
"the",
"target",
"entry",
"for",
"a",
"given",
"patch",
"element",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L226-L250
|
158,787 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.complete
|
private void complete(final InstallationManager.InstallationModification modification, final FinalizeCallback callback) {
final List<File> processed = new ArrayList<File>();
List<File> reenabled = Collections.emptyList();
List<File> disabled = Collections.emptyList();
try {
try {
// Update the state to invalidate and process module resources
if (stateUpdater.compareAndSet(this, State.PREPARED, State.INVALIDATE)) {
if (mode == PatchingTaskContext.Mode.APPLY) {
// Only invalidate modules when applying patches; on rollback files are immediately restored
for (final File invalidation : moduleInvalidations) {
processed.add(invalidation);
PatchModuleInvalidationUtils.processFile(this, invalidation, mode);
}
if (!modulesToReenable.isEmpty()) {
reenabled = new ArrayList<File>(modulesToReenable.size());
for (final File path : modulesToReenable) {
reenabled.add(path);
PatchModuleInvalidationUtils.processFile(this, path, PatchingTaskContext.Mode.ROLLBACK);
}
}
} else if(mode == PatchingTaskContext.Mode.ROLLBACK) {
if (!modulesToDisable.isEmpty()) {
disabled = new ArrayList<File>(modulesToDisable.size());
for (final File path : modulesToDisable) {
disabled.add(path);
PatchModuleInvalidationUtils.processFile(this, path, PatchingTaskContext.Mode.APPLY);
}
}
}
}
modification.complete();
callback.completed(this);
state = State.COMPLETED;
} catch (Exception e) {
this.moduleInvalidations.clear();
this.moduleInvalidations.addAll(processed);
this.modulesToReenable.clear();
this.modulesToReenable.addAll(reenabled);
this.modulesToDisable.clear();
this.moduleInvalidations.addAll(disabled);
throw new RuntimeException(e);
}
} finally {
if (state != State.COMPLETED) {
try {
modification.cancel();
} finally {
try {
undoChanges();
} finally {
callback.operationCancelled(this);
}
}
} else {
try {
if (checkForGarbageOnRestart) {
final File cleanupMarker = new File(installedImage.getInstallationMetadata(), "cleanup-patching-dirs");
cleanupMarker.createNewFile();
}
storeFailedRenaming();
} catch (IOException e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to create cleanup marker");
}
}
}
}
|
java
|
private void complete(final InstallationManager.InstallationModification modification, final FinalizeCallback callback) {
final List<File> processed = new ArrayList<File>();
List<File> reenabled = Collections.emptyList();
List<File> disabled = Collections.emptyList();
try {
try {
// Update the state to invalidate and process module resources
if (stateUpdater.compareAndSet(this, State.PREPARED, State.INVALIDATE)) {
if (mode == PatchingTaskContext.Mode.APPLY) {
// Only invalidate modules when applying patches; on rollback files are immediately restored
for (final File invalidation : moduleInvalidations) {
processed.add(invalidation);
PatchModuleInvalidationUtils.processFile(this, invalidation, mode);
}
if (!modulesToReenable.isEmpty()) {
reenabled = new ArrayList<File>(modulesToReenable.size());
for (final File path : modulesToReenable) {
reenabled.add(path);
PatchModuleInvalidationUtils.processFile(this, path, PatchingTaskContext.Mode.ROLLBACK);
}
}
} else if(mode == PatchingTaskContext.Mode.ROLLBACK) {
if (!modulesToDisable.isEmpty()) {
disabled = new ArrayList<File>(modulesToDisable.size());
for (final File path : modulesToDisable) {
disabled.add(path);
PatchModuleInvalidationUtils.processFile(this, path, PatchingTaskContext.Mode.APPLY);
}
}
}
}
modification.complete();
callback.completed(this);
state = State.COMPLETED;
} catch (Exception e) {
this.moduleInvalidations.clear();
this.moduleInvalidations.addAll(processed);
this.modulesToReenable.clear();
this.modulesToReenable.addAll(reenabled);
this.modulesToDisable.clear();
this.moduleInvalidations.addAll(disabled);
throw new RuntimeException(e);
}
} finally {
if (state != State.COMPLETED) {
try {
modification.cancel();
} finally {
try {
undoChanges();
} finally {
callback.operationCancelled(this);
}
}
} else {
try {
if (checkForGarbageOnRestart) {
final File cleanupMarker = new File(installedImage.getInstallationMetadata(), "cleanup-patching-dirs");
cleanupMarker.createNewFile();
}
storeFailedRenaming();
} catch (IOException e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to create cleanup marker");
}
}
}
}
|
[
"private",
"void",
"complete",
"(",
"final",
"InstallationManager",
".",
"InstallationModification",
"modification",
",",
"final",
"FinalizeCallback",
"callback",
")",
"{",
"final",
"List",
"<",
"File",
">",
"processed",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"List",
"<",
"File",
">",
"reenabled",
"=",
"Collections",
".",
"emptyList",
"(",
")",
";",
"List",
"<",
"File",
">",
"disabled",
"=",
"Collections",
".",
"emptyList",
"(",
")",
";",
"try",
"{",
"try",
"{",
"// Update the state to invalidate and process module resources",
"if",
"(",
"stateUpdater",
".",
"compareAndSet",
"(",
"this",
",",
"State",
".",
"PREPARED",
",",
"State",
".",
"INVALIDATE",
")",
")",
"{",
"if",
"(",
"mode",
"==",
"PatchingTaskContext",
".",
"Mode",
".",
"APPLY",
")",
"{",
"// Only invalidate modules when applying patches; on rollback files are immediately restored",
"for",
"(",
"final",
"File",
"invalidation",
":",
"moduleInvalidations",
")",
"{",
"processed",
".",
"add",
"(",
"invalidation",
")",
";",
"PatchModuleInvalidationUtils",
".",
"processFile",
"(",
"this",
",",
"invalidation",
",",
"mode",
")",
";",
"}",
"if",
"(",
"!",
"modulesToReenable",
".",
"isEmpty",
"(",
")",
")",
"{",
"reenabled",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
"modulesToReenable",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"File",
"path",
":",
"modulesToReenable",
")",
"{",
"reenabled",
".",
"add",
"(",
"path",
")",
";",
"PatchModuleInvalidationUtils",
".",
"processFile",
"(",
"this",
",",
"path",
",",
"PatchingTaskContext",
".",
"Mode",
".",
"ROLLBACK",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"mode",
"==",
"PatchingTaskContext",
".",
"Mode",
".",
"ROLLBACK",
")",
"{",
"if",
"(",
"!",
"modulesToDisable",
".",
"isEmpty",
"(",
")",
")",
"{",
"disabled",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
"modulesToDisable",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"File",
"path",
":",
"modulesToDisable",
")",
"{",
"disabled",
".",
"add",
"(",
"path",
")",
";",
"PatchModuleInvalidationUtils",
".",
"processFile",
"(",
"this",
",",
"path",
",",
"PatchingTaskContext",
".",
"Mode",
".",
"APPLY",
")",
";",
"}",
"}",
"}",
"}",
"modification",
".",
"complete",
"(",
")",
";",
"callback",
".",
"completed",
"(",
"this",
")",
";",
"state",
"=",
"State",
".",
"COMPLETED",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"this",
".",
"moduleInvalidations",
".",
"clear",
"(",
")",
";",
"this",
".",
"moduleInvalidations",
".",
"addAll",
"(",
"processed",
")",
";",
"this",
".",
"modulesToReenable",
".",
"clear",
"(",
")",
";",
"this",
".",
"modulesToReenable",
".",
"addAll",
"(",
"reenabled",
")",
";",
"this",
".",
"modulesToDisable",
".",
"clear",
"(",
")",
";",
"this",
".",
"moduleInvalidations",
".",
"addAll",
"(",
"disabled",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"state",
"!=",
"State",
".",
"COMPLETED",
")",
"{",
"try",
"{",
"modification",
".",
"cancel",
"(",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"undoChanges",
"(",
")",
";",
"}",
"finally",
"{",
"callback",
".",
"operationCancelled",
"(",
"this",
")",
";",
"}",
"}",
"}",
"else",
"{",
"try",
"{",
"if",
"(",
"checkForGarbageOnRestart",
")",
"{",
"final",
"File",
"cleanupMarker",
"=",
"new",
"File",
"(",
"installedImage",
".",
"getInstallationMetadata",
"(",
")",
",",
"\"cleanup-patching-dirs\"",
")",
";",
"cleanupMarker",
".",
"createNewFile",
"(",
")",
";",
"}",
"storeFailedRenaming",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"debugf",
"(",
"e",
",",
"\"failed to create cleanup marker\"",
")",
";",
"}",
"}",
"}",
"}"
] |
Complete the current operation and persist the current state to the disk. This will also trigger the invalidation
of outdated modules.
@param modification the current modification
@param callback the completion callback
|
[
"Complete",
"the",
"current",
"operation",
"and",
"persist",
"the",
"current",
"state",
"to",
"the",
"disk",
".",
"This",
"will",
"also",
"trigger",
"the",
"invalidation",
"of",
"outdated",
"modules",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L352-L419
|
158,788 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.undoChanges
|
boolean undoChanges() {
final State state = stateUpdater.getAndSet(this, State.ROLLBACK_ONLY);
if (state == State.COMPLETED || state == State.ROLLBACK_ONLY) {
// Was actually completed already
return false;
}
PatchingTaskContext.Mode currentMode = this.mode;
mode = PatchingTaskContext.Mode.UNDO;
final PatchContentLoader loader = PatchContentLoader.create(miscBackup, null, null);
// Undo changes for the identity
undoChanges(identityEntry, loader);
// TODO maybe check if we need to do something for the layers too !?
if (state == State.INVALIDATE || currentMode == PatchingTaskContext.Mode.ROLLBACK) {
// For apply the state needs to be invalidate
// For rollback the files are invalidated as part of the tasks
final PatchingTaskContext.Mode mode = currentMode == PatchingTaskContext.Mode.APPLY ? PatchingTaskContext.Mode.ROLLBACK : PatchingTaskContext.Mode.APPLY;
for (final File file : moduleInvalidations) {
try {
PatchModuleInvalidationUtils.processFile(this, file, mode);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
}
}
if(!modulesToReenable.isEmpty()) {
for (final File file : modulesToReenable) {
try {
PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.APPLY);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
}
}
}
if(!modulesToDisable.isEmpty()) {
for (final File file : modulesToDisable) {
try {
PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.ROLLBACK);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
}
}
}
}
return true;
}
|
java
|
boolean undoChanges() {
final State state = stateUpdater.getAndSet(this, State.ROLLBACK_ONLY);
if (state == State.COMPLETED || state == State.ROLLBACK_ONLY) {
// Was actually completed already
return false;
}
PatchingTaskContext.Mode currentMode = this.mode;
mode = PatchingTaskContext.Mode.UNDO;
final PatchContentLoader loader = PatchContentLoader.create(miscBackup, null, null);
// Undo changes for the identity
undoChanges(identityEntry, loader);
// TODO maybe check if we need to do something for the layers too !?
if (state == State.INVALIDATE || currentMode == PatchingTaskContext.Mode.ROLLBACK) {
// For apply the state needs to be invalidate
// For rollback the files are invalidated as part of the tasks
final PatchingTaskContext.Mode mode = currentMode == PatchingTaskContext.Mode.APPLY ? PatchingTaskContext.Mode.ROLLBACK : PatchingTaskContext.Mode.APPLY;
for (final File file : moduleInvalidations) {
try {
PatchModuleInvalidationUtils.processFile(this, file, mode);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
}
}
if(!modulesToReenable.isEmpty()) {
for (final File file : modulesToReenable) {
try {
PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.APPLY);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
}
}
}
if(!modulesToDisable.isEmpty()) {
for (final File file : modulesToDisable) {
try {
PatchModuleInvalidationUtils.processFile(this, file, PatchingTaskContext.Mode.ROLLBACK);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.debugf(e, "failed to restore state for %s", file);
}
}
}
}
return true;
}
|
[
"boolean",
"undoChanges",
"(",
")",
"{",
"final",
"State",
"state",
"=",
"stateUpdater",
".",
"getAndSet",
"(",
"this",
",",
"State",
".",
"ROLLBACK_ONLY",
")",
";",
"if",
"(",
"state",
"==",
"State",
".",
"COMPLETED",
"||",
"state",
"==",
"State",
".",
"ROLLBACK_ONLY",
")",
"{",
"// Was actually completed already",
"return",
"false",
";",
"}",
"PatchingTaskContext",
".",
"Mode",
"currentMode",
"=",
"this",
".",
"mode",
";",
"mode",
"=",
"PatchingTaskContext",
".",
"Mode",
".",
"UNDO",
";",
"final",
"PatchContentLoader",
"loader",
"=",
"PatchContentLoader",
".",
"create",
"(",
"miscBackup",
",",
"null",
",",
"null",
")",
";",
"// Undo changes for the identity",
"undoChanges",
"(",
"identityEntry",
",",
"loader",
")",
";",
"// TODO maybe check if we need to do something for the layers too !?",
"if",
"(",
"state",
"==",
"State",
".",
"INVALIDATE",
"||",
"currentMode",
"==",
"PatchingTaskContext",
".",
"Mode",
".",
"ROLLBACK",
")",
"{",
"// For apply the state needs to be invalidate",
"// For rollback the files are invalidated as part of the tasks",
"final",
"PatchingTaskContext",
".",
"Mode",
"mode",
"=",
"currentMode",
"==",
"PatchingTaskContext",
".",
"Mode",
".",
"APPLY",
"?",
"PatchingTaskContext",
".",
"Mode",
".",
"ROLLBACK",
":",
"PatchingTaskContext",
".",
"Mode",
".",
"APPLY",
";",
"for",
"(",
"final",
"File",
"file",
":",
"moduleInvalidations",
")",
"{",
"try",
"{",
"PatchModuleInvalidationUtils",
".",
"processFile",
"(",
"this",
",",
"file",
",",
"mode",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"debugf",
"(",
"e",
",",
"\"failed to restore state for %s\"",
",",
"file",
")",
";",
"}",
"}",
"if",
"(",
"!",
"modulesToReenable",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"File",
"file",
":",
"modulesToReenable",
")",
"{",
"try",
"{",
"PatchModuleInvalidationUtils",
".",
"processFile",
"(",
"this",
",",
"file",
",",
"PatchingTaskContext",
".",
"Mode",
".",
"APPLY",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"debugf",
"(",
"e",
",",
"\"failed to restore state for %s\"",
",",
"file",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"modulesToDisable",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"File",
"file",
":",
"modulesToDisable",
")",
"{",
"try",
"{",
"PatchModuleInvalidationUtils",
".",
"processFile",
"(",
"this",
",",
"file",
",",
"PatchingTaskContext",
".",
"Mode",
".",
"ROLLBACK",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"debugf",
"(",
"e",
",",
"\"failed to restore state for %s\"",
",",
"file",
")",
";",
"}",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] |
Internally undo recorded changes we did so far.
@return whether the state required undo actions
|
[
"Internally",
"undo",
"recorded",
"changes",
"we",
"did",
"so",
"far",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L437-L480
|
158,789 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.undoChanges
|
static void undoChanges(final PatchEntry entry, final PatchContentLoader loader) {
final List<ContentModification> modifications = new ArrayList<ContentModification>(entry.rollbackActions);
for (final ContentModification modification : modifications) {
final ContentItem item = modification.getItem();
if (item.getContentType() != ContentType.MISC) {
// Skip modules and bundles they should be removed as part of the {@link FinalizeCallback}
continue;
}
final PatchingTaskDescription description = new PatchingTaskDescription(entry.applyPatchId, modification, loader, false, false, false);
try {
final PatchingTask task = PatchingTask.Factory.create(description, entry);
task.execute(entry);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.failedToUndoChange(item.toString());
}
}
}
|
java
|
static void undoChanges(final PatchEntry entry, final PatchContentLoader loader) {
final List<ContentModification> modifications = new ArrayList<ContentModification>(entry.rollbackActions);
for (final ContentModification modification : modifications) {
final ContentItem item = modification.getItem();
if (item.getContentType() != ContentType.MISC) {
// Skip modules and bundles they should be removed as part of the {@link FinalizeCallback}
continue;
}
final PatchingTaskDescription description = new PatchingTaskDescription(entry.applyPatchId, modification, loader, false, false, false);
try {
final PatchingTask task = PatchingTask.Factory.create(description, entry);
task.execute(entry);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.failedToUndoChange(item.toString());
}
}
}
|
[
"static",
"void",
"undoChanges",
"(",
"final",
"PatchEntry",
"entry",
",",
"final",
"PatchContentLoader",
"loader",
")",
"{",
"final",
"List",
"<",
"ContentModification",
">",
"modifications",
"=",
"new",
"ArrayList",
"<",
"ContentModification",
">",
"(",
"entry",
".",
"rollbackActions",
")",
";",
"for",
"(",
"final",
"ContentModification",
"modification",
":",
"modifications",
")",
"{",
"final",
"ContentItem",
"item",
"=",
"modification",
".",
"getItem",
"(",
")",
";",
"if",
"(",
"item",
".",
"getContentType",
"(",
")",
"!=",
"ContentType",
".",
"MISC",
")",
"{",
"// Skip modules and bundles they should be removed as part of the {@link FinalizeCallback}",
"continue",
";",
"}",
"final",
"PatchingTaskDescription",
"description",
"=",
"new",
"PatchingTaskDescription",
"(",
"entry",
".",
"applyPatchId",
",",
"modification",
",",
"loader",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"try",
"{",
"final",
"PatchingTask",
"task",
"=",
"PatchingTask",
".",
"Factory",
".",
"create",
"(",
"description",
",",
"entry",
")",
";",
"task",
".",
"execute",
"(",
"entry",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"failedToUndoChange",
"(",
"item",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Undo changes for a single patch entry.
@param entry the patch entry
@param loader the content loader
|
[
"Undo",
"changes",
"for",
"a",
"single",
"patch",
"entry",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L488-L504
|
158,790 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.recordRollbackLoader
|
private void recordRollbackLoader(final String patchId, PatchableTarget.TargetInfo target) {
// setup the content loader paths
final DirectoryStructure structure = target.getDirectoryStructure();
final InstalledImage image = structure.getInstalledImage();
final File historyDir = image.getPatchHistoryDir(patchId);
final File miscRoot = new File(historyDir, PatchContentLoader.MISC);
final File modulesRoot = structure.getModulePatchDirectory(patchId);
final File bundlesRoot = structure.getBundlesPatchDirectory(patchId);
final PatchContentLoader loader = PatchContentLoader.create(miscRoot, bundlesRoot, modulesRoot);
//
recordContentLoader(patchId, loader);
}
|
java
|
private void recordRollbackLoader(final String patchId, PatchableTarget.TargetInfo target) {
// setup the content loader paths
final DirectoryStructure structure = target.getDirectoryStructure();
final InstalledImage image = structure.getInstalledImage();
final File historyDir = image.getPatchHistoryDir(patchId);
final File miscRoot = new File(historyDir, PatchContentLoader.MISC);
final File modulesRoot = structure.getModulePatchDirectory(patchId);
final File bundlesRoot = structure.getBundlesPatchDirectory(patchId);
final PatchContentLoader loader = PatchContentLoader.create(miscRoot, bundlesRoot, modulesRoot);
//
recordContentLoader(patchId, loader);
}
|
[
"private",
"void",
"recordRollbackLoader",
"(",
"final",
"String",
"patchId",
",",
"PatchableTarget",
".",
"TargetInfo",
"target",
")",
"{",
"// setup the content loader paths",
"final",
"DirectoryStructure",
"structure",
"=",
"target",
".",
"getDirectoryStructure",
"(",
")",
";",
"final",
"InstalledImage",
"image",
"=",
"structure",
".",
"getInstalledImage",
"(",
")",
";",
"final",
"File",
"historyDir",
"=",
"image",
".",
"getPatchHistoryDir",
"(",
"patchId",
")",
";",
"final",
"File",
"miscRoot",
"=",
"new",
"File",
"(",
"historyDir",
",",
"PatchContentLoader",
".",
"MISC",
")",
";",
"final",
"File",
"modulesRoot",
"=",
"structure",
".",
"getModulePatchDirectory",
"(",
"patchId",
")",
";",
"final",
"File",
"bundlesRoot",
"=",
"structure",
".",
"getBundlesPatchDirectory",
"(",
"patchId",
")",
";",
"final",
"PatchContentLoader",
"loader",
"=",
"PatchContentLoader",
".",
"create",
"(",
"miscRoot",
",",
"bundlesRoot",
",",
"modulesRoot",
")",
";",
"//",
"recordContentLoader",
"(",
"patchId",
",",
"loader",
")",
";",
"}"
] |
Add a rollback loader for a give patch.
@param patchId the patch id.
@param target the patchable target
@throws XMLStreamException
@throws IOException
|
[
"Add",
"a",
"rollback",
"loader",
"for",
"a",
"give",
"patch",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L514-L525
|
158,791 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.recordContentLoader
|
protected void recordContentLoader(final String patchID, final PatchContentLoader contentLoader) {
if (contentLoaders.containsKey(patchID)) {
throw new IllegalStateException("Content loader already registered for patch " + patchID); // internal wrong usage, no i18n
}
contentLoaders.put(patchID, contentLoader);
}
|
java
|
protected void recordContentLoader(final String patchID, final PatchContentLoader contentLoader) {
if (contentLoaders.containsKey(patchID)) {
throw new IllegalStateException("Content loader already registered for patch " + patchID); // internal wrong usage, no i18n
}
contentLoaders.put(patchID, contentLoader);
}
|
[
"protected",
"void",
"recordContentLoader",
"(",
"final",
"String",
"patchID",
",",
"final",
"PatchContentLoader",
"contentLoader",
")",
"{",
"if",
"(",
"contentLoaders",
".",
"containsKey",
"(",
"patchID",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Content loader already registered for patch \"",
"+",
"patchID",
")",
";",
"// internal wrong usage, no i18n",
"}",
"contentLoaders",
".",
"put",
"(",
"patchID",
",",
"contentLoader",
")",
";",
"}"
] |
Record a content loader for a given patch id.
@param patchID the patch id
@param contentLoader the content loader
|
[
"Record",
"a",
"content",
"loader",
"for",
"a",
"given",
"patch",
"id",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L533-L538
|
158,792 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.getTargetFile
|
public File getTargetFile(final MiscContentItem item) {
final State state = this.state;
if (state == State.NEW || state == State.ROLLBACK_ONLY) {
return getTargetFile(miscTargetRoot, item);
} else {
throw new IllegalStateException(); // internal wrong usage, no i18n
}
}
|
java
|
public File getTargetFile(final MiscContentItem item) {
final State state = this.state;
if (state == State.NEW || state == State.ROLLBACK_ONLY) {
return getTargetFile(miscTargetRoot, item);
} else {
throw new IllegalStateException(); // internal wrong usage, no i18n
}
}
|
[
"public",
"File",
"getTargetFile",
"(",
"final",
"MiscContentItem",
"item",
")",
"{",
"final",
"State",
"state",
"=",
"this",
".",
"state",
";",
"if",
"(",
"state",
"==",
"State",
".",
"NEW",
"||",
"state",
"==",
"State",
".",
"ROLLBACK_ONLY",
")",
"{",
"return",
"getTargetFile",
"(",
"miscTargetRoot",
",",
"item",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"// internal wrong usage, no i18n",
"}",
"}"
] |
Get the target file for misc items.
@param item the misc item
@return the target location
|
[
"Get",
"the",
"target",
"file",
"for",
"misc",
"items",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L566-L573
|
158,793 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.createProcessedPatch
|
protected Patch createProcessedPatch(final Patch original) {
// Process elements
final List<PatchElement> elements = new ArrayList<PatchElement>();
// Process layers
for (final PatchEntry entry : getLayers()) {
final PatchElement element = createPatchElement(entry, entry.element.getId(), entry.modifications);
elements.add(element);
}
// Process add-ons
for (final PatchEntry entry : getAddOns()) {
final PatchElement element = createPatchElement(entry, entry.element.getId(), entry.modifications);
elements.add(element);
}
// Swap the patch element modifications, keep the identity ones since we don't need to fix the misc modifications
return new PatchImpl(original.getPatchId(), original.getDescription(), original.getLink(), original.getIdentity(), elements, identityEntry.modifications);
}
|
java
|
protected Patch createProcessedPatch(final Patch original) {
// Process elements
final List<PatchElement> elements = new ArrayList<PatchElement>();
// Process layers
for (final PatchEntry entry : getLayers()) {
final PatchElement element = createPatchElement(entry, entry.element.getId(), entry.modifications);
elements.add(element);
}
// Process add-ons
for (final PatchEntry entry : getAddOns()) {
final PatchElement element = createPatchElement(entry, entry.element.getId(), entry.modifications);
elements.add(element);
}
// Swap the patch element modifications, keep the identity ones since we don't need to fix the misc modifications
return new PatchImpl(original.getPatchId(), original.getDescription(), original.getLink(), original.getIdentity(), elements, identityEntry.modifications);
}
|
[
"protected",
"Patch",
"createProcessedPatch",
"(",
"final",
"Patch",
"original",
")",
"{",
"// Process elements",
"final",
"List",
"<",
"PatchElement",
">",
"elements",
"=",
"new",
"ArrayList",
"<",
"PatchElement",
">",
"(",
")",
";",
"// Process layers",
"for",
"(",
"final",
"PatchEntry",
"entry",
":",
"getLayers",
"(",
")",
")",
"{",
"final",
"PatchElement",
"element",
"=",
"createPatchElement",
"(",
"entry",
",",
"entry",
".",
"element",
".",
"getId",
"(",
")",
",",
"entry",
".",
"modifications",
")",
";",
"elements",
".",
"add",
"(",
"element",
")",
";",
"}",
"// Process add-ons",
"for",
"(",
"final",
"PatchEntry",
"entry",
":",
"getAddOns",
"(",
")",
")",
"{",
"final",
"PatchElement",
"element",
"=",
"createPatchElement",
"(",
"entry",
",",
"entry",
".",
"element",
".",
"getId",
"(",
")",
",",
"entry",
".",
"modifications",
")",
";",
"elements",
".",
"add",
"(",
"element",
")",
";",
"}",
"// Swap the patch element modifications, keep the identity ones since we don't need to fix the misc modifications",
"return",
"new",
"PatchImpl",
"(",
"original",
".",
"getPatchId",
"(",
")",
",",
"original",
".",
"getDescription",
"(",
")",
",",
"original",
".",
"getLink",
"(",
")",
",",
"original",
".",
"getIdentity",
"(",
")",
",",
"elements",
",",
"identityEntry",
".",
"modifications",
")",
";",
"}"
] |
Create a patch representing what we actually processed. This may contain some fixed content hashes for removed
modules.
@param original the original
@return the processed patch
|
[
"Create",
"a",
"patch",
"representing",
"what",
"we",
"actually",
"processed",
".",
"This",
"may",
"contain",
"some",
"fixed",
"content",
"hashes",
"for",
"removed",
"modules",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L582-L599
|
158,794 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.createRollbackPatch
|
protected RollbackPatch createRollbackPatch(final String patchId, final Patch.PatchType patchType) {
// Process elements
final List<PatchElement> elements = new ArrayList<PatchElement>();
// Process layers
for (final PatchEntry entry : getLayers()) {
final PatchElement element = createRollbackElement(entry);
elements.add(element);
}
// Process add-ons
for (final PatchEntry entry : getAddOns()) {
final PatchElement element = createRollbackElement(entry);
elements.add(element);
}
final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState();
final String name = installedIdentity.getIdentity().getName();
final IdentityImpl identity = new IdentityImpl(name, modification.getVersion());
if (patchType == Patch.PatchType.CUMULATIVE) {
identity.setPatchType(Patch.PatchType.CUMULATIVE);
identity.setResultingVersion(installedIdentity.getIdentity().getVersion());
} else if (patchType == Patch.PatchType.ONE_OFF) {
identity.setPatchType(Patch.PatchType.ONE_OFF);
}
final List<ContentModification> modifications = identityEntry.rollbackActions;
final Patch delegate = new PatchImpl(patchId, "rollback patch", identity, elements, modifications);
return new PatchImpl.RollbackPatchImpl(delegate, installedIdentity);
}
|
java
|
protected RollbackPatch createRollbackPatch(final String patchId, final Patch.PatchType patchType) {
// Process elements
final List<PatchElement> elements = new ArrayList<PatchElement>();
// Process layers
for (final PatchEntry entry : getLayers()) {
final PatchElement element = createRollbackElement(entry);
elements.add(element);
}
// Process add-ons
for (final PatchEntry entry : getAddOns()) {
final PatchElement element = createRollbackElement(entry);
elements.add(element);
}
final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState();
final String name = installedIdentity.getIdentity().getName();
final IdentityImpl identity = new IdentityImpl(name, modification.getVersion());
if (patchType == Patch.PatchType.CUMULATIVE) {
identity.setPatchType(Patch.PatchType.CUMULATIVE);
identity.setResultingVersion(installedIdentity.getIdentity().getVersion());
} else if (patchType == Patch.PatchType.ONE_OFF) {
identity.setPatchType(Patch.PatchType.ONE_OFF);
}
final List<ContentModification> modifications = identityEntry.rollbackActions;
final Patch delegate = new PatchImpl(patchId, "rollback patch", identity, elements, modifications);
return new PatchImpl.RollbackPatchImpl(delegate, installedIdentity);
}
|
[
"protected",
"RollbackPatch",
"createRollbackPatch",
"(",
"final",
"String",
"patchId",
",",
"final",
"Patch",
".",
"PatchType",
"patchType",
")",
"{",
"// Process elements",
"final",
"List",
"<",
"PatchElement",
">",
"elements",
"=",
"new",
"ArrayList",
"<",
"PatchElement",
">",
"(",
")",
";",
"// Process layers",
"for",
"(",
"final",
"PatchEntry",
"entry",
":",
"getLayers",
"(",
")",
")",
"{",
"final",
"PatchElement",
"element",
"=",
"createRollbackElement",
"(",
"entry",
")",
";",
"elements",
".",
"add",
"(",
"element",
")",
";",
"}",
"// Process add-ons",
"for",
"(",
"final",
"PatchEntry",
"entry",
":",
"getAddOns",
"(",
")",
")",
"{",
"final",
"PatchElement",
"element",
"=",
"createRollbackElement",
"(",
"entry",
")",
";",
"elements",
".",
"add",
"(",
"element",
")",
";",
"}",
"final",
"InstalledIdentity",
"installedIdentity",
"=",
"modification",
".",
"getUnmodifiedInstallationState",
"(",
")",
";",
"final",
"String",
"name",
"=",
"installedIdentity",
".",
"getIdentity",
"(",
")",
".",
"getName",
"(",
")",
";",
"final",
"IdentityImpl",
"identity",
"=",
"new",
"IdentityImpl",
"(",
"name",
",",
"modification",
".",
"getVersion",
"(",
")",
")",
";",
"if",
"(",
"patchType",
"==",
"Patch",
".",
"PatchType",
".",
"CUMULATIVE",
")",
"{",
"identity",
".",
"setPatchType",
"(",
"Patch",
".",
"PatchType",
".",
"CUMULATIVE",
")",
";",
"identity",
".",
"setResultingVersion",
"(",
"installedIdentity",
".",
"getIdentity",
"(",
")",
".",
"getVersion",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"patchType",
"==",
"Patch",
".",
"PatchType",
".",
"ONE_OFF",
")",
"{",
"identity",
".",
"setPatchType",
"(",
"Patch",
".",
"PatchType",
".",
"ONE_OFF",
")",
";",
"}",
"final",
"List",
"<",
"ContentModification",
">",
"modifications",
"=",
"identityEntry",
".",
"rollbackActions",
";",
"final",
"Patch",
"delegate",
"=",
"new",
"PatchImpl",
"(",
"patchId",
",",
"\"rollback patch\"",
",",
"identity",
",",
"elements",
",",
"modifications",
")",
";",
"return",
"new",
"PatchImpl",
".",
"RollbackPatchImpl",
"(",
"delegate",
",",
"installedIdentity",
")",
";",
"}"
] |
Create a rollback patch based on the recorded actions.
@param patchId the new patch id, depending on release or one-off
@param patchType the current patch identity
@return the rollback patch
|
[
"Create",
"a",
"rollback",
"patch",
"based",
"on",
"the",
"recorded",
"actions",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L608-L634
|
158,795 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.getTargetFile
|
static File getTargetFile(final File root, final MiscContentItem item) {
return PatchContentLoader.getMiscPath(root, item);
}
|
java
|
static File getTargetFile(final File root, final MiscContentItem item) {
return PatchContentLoader.getMiscPath(root, item);
}
|
[
"static",
"File",
"getTargetFile",
"(",
"final",
"File",
"root",
",",
"final",
"MiscContentItem",
"item",
")",
"{",
"return",
"PatchContentLoader",
".",
"getMiscPath",
"(",
"root",
",",
"item",
")",
";",
"}"
] |
Get a misc file.
@param root the root
@param item the misc content item
@return the misc file
|
[
"Get",
"a",
"misc",
"file",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L643-L645
|
158,796 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.createRollbackElement
|
protected static PatchElement createRollbackElement(final PatchEntry entry) {
final PatchElement patchElement = entry.element;
final String patchId;
final Patch.PatchType patchType = patchElement.getProvider().getPatchType();
if (patchType == Patch.PatchType.CUMULATIVE) {
patchId = entry.getCumulativePatchID();
} else {
patchId = patchElement.getId();
}
return createPatchElement(entry, patchId, entry.rollbackActions);
}
|
java
|
protected static PatchElement createRollbackElement(final PatchEntry entry) {
final PatchElement patchElement = entry.element;
final String patchId;
final Patch.PatchType patchType = patchElement.getProvider().getPatchType();
if (patchType == Patch.PatchType.CUMULATIVE) {
patchId = entry.getCumulativePatchID();
} else {
patchId = patchElement.getId();
}
return createPatchElement(entry, patchId, entry.rollbackActions);
}
|
[
"protected",
"static",
"PatchElement",
"createRollbackElement",
"(",
"final",
"PatchEntry",
"entry",
")",
"{",
"final",
"PatchElement",
"patchElement",
"=",
"entry",
".",
"element",
";",
"final",
"String",
"patchId",
";",
"final",
"Patch",
".",
"PatchType",
"patchType",
"=",
"patchElement",
".",
"getProvider",
"(",
")",
".",
"getPatchType",
"(",
")",
";",
"if",
"(",
"patchType",
"==",
"Patch",
".",
"PatchType",
".",
"CUMULATIVE",
")",
"{",
"patchId",
"=",
"entry",
".",
"getCumulativePatchID",
"(",
")",
";",
"}",
"else",
"{",
"patchId",
"=",
"patchElement",
".",
"getId",
"(",
")",
";",
"}",
"return",
"createPatchElement",
"(",
"entry",
",",
"patchId",
",",
"entry",
".",
"rollbackActions",
")",
";",
"}"
] |
Create a patch element for the rollback patch.
@param entry the entry
@return the new patch element
|
[
"Create",
"a",
"patch",
"element",
"for",
"the",
"rollback",
"patch",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L940-L950
|
158,797 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.createPatchElement
|
protected static PatchElement createPatchElement(final PatchEntry entry, String patchId, final List<ContentModification> modifications) {
final PatchElement patchElement = entry.element;
final PatchElementImpl element = new PatchElementImpl(patchId);
element.setProvider(patchElement.getProvider());
// Add all the rollback actions
element.getModifications().addAll(modifications);
element.setDescription(patchElement.getDescription());
return element;
}
|
java
|
protected static PatchElement createPatchElement(final PatchEntry entry, String patchId, final List<ContentModification> modifications) {
final PatchElement patchElement = entry.element;
final PatchElementImpl element = new PatchElementImpl(patchId);
element.setProvider(patchElement.getProvider());
// Add all the rollback actions
element.getModifications().addAll(modifications);
element.setDescription(patchElement.getDescription());
return element;
}
|
[
"protected",
"static",
"PatchElement",
"createPatchElement",
"(",
"final",
"PatchEntry",
"entry",
",",
"String",
"patchId",
",",
"final",
"List",
"<",
"ContentModification",
">",
"modifications",
")",
"{",
"final",
"PatchElement",
"patchElement",
"=",
"entry",
".",
"element",
";",
"final",
"PatchElementImpl",
"element",
"=",
"new",
"PatchElementImpl",
"(",
"patchId",
")",
";",
"element",
".",
"setProvider",
"(",
"patchElement",
".",
"getProvider",
"(",
")",
")",
";",
"// Add all the rollback actions",
"element",
".",
"getModifications",
"(",
")",
".",
"addAll",
"(",
"modifications",
")",
";",
"element",
".",
"setDescription",
"(",
"patchElement",
".",
"getDescription",
"(",
")",
")",
";",
"return",
"element",
";",
"}"
] |
Copy a patch element
@param entry the patch entry
@param patchId the patch id for the element
@param modifications the element modifications
@return the new patch element
|
[
"Copy",
"a",
"patch",
"element"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L960-L968
|
158,798 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.backupConfiguration
|
void backupConfiguration() throws IOException {
final String configuration = Constants.CONFIGURATION;
final File a = new File(installedImage.getAppClientDir(), configuration);
final File d = new File(installedImage.getDomainDir(), configuration);
final File s = new File(installedImage.getStandaloneDir(), configuration);
if (a.exists()) {
final File ab = new File(configBackup, Constants.APP_CLIENT);
backupDirectory(a, ab);
}
if (d.exists()) {
final File db = new File(configBackup, Constants.DOMAIN);
backupDirectory(d, db);
}
if (s.exists()) {
final File sb = new File(configBackup, Constants.STANDALONE);
backupDirectory(s, sb);
}
}
|
java
|
void backupConfiguration() throws IOException {
final String configuration = Constants.CONFIGURATION;
final File a = new File(installedImage.getAppClientDir(), configuration);
final File d = new File(installedImage.getDomainDir(), configuration);
final File s = new File(installedImage.getStandaloneDir(), configuration);
if (a.exists()) {
final File ab = new File(configBackup, Constants.APP_CLIENT);
backupDirectory(a, ab);
}
if (d.exists()) {
final File db = new File(configBackup, Constants.DOMAIN);
backupDirectory(d, db);
}
if (s.exists()) {
final File sb = new File(configBackup, Constants.STANDALONE);
backupDirectory(s, sb);
}
}
|
[
"void",
"backupConfiguration",
"(",
")",
"throws",
"IOException",
"{",
"final",
"String",
"configuration",
"=",
"Constants",
".",
"CONFIGURATION",
";",
"final",
"File",
"a",
"=",
"new",
"File",
"(",
"installedImage",
".",
"getAppClientDir",
"(",
")",
",",
"configuration",
")",
";",
"final",
"File",
"d",
"=",
"new",
"File",
"(",
"installedImage",
".",
"getDomainDir",
"(",
")",
",",
"configuration",
")",
";",
"final",
"File",
"s",
"=",
"new",
"File",
"(",
"installedImage",
".",
"getStandaloneDir",
"(",
")",
",",
"configuration",
")",
";",
"if",
"(",
"a",
".",
"exists",
"(",
")",
")",
"{",
"final",
"File",
"ab",
"=",
"new",
"File",
"(",
"configBackup",
",",
"Constants",
".",
"APP_CLIENT",
")",
";",
"backupDirectory",
"(",
"a",
",",
"ab",
")",
";",
"}",
"if",
"(",
"d",
".",
"exists",
"(",
")",
")",
"{",
"final",
"File",
"db",
"=",
"new",
"File",
"(",
"configBackup",
",",
"Constants",
".",
"DOMAIN",
")",
";",
"backupDirectory",
"(",
"d",
",",
"db",
")",
";",
"}",
"if",
"(",
"s",
".",
"exists",
"(",
")",
")",
"{",
"final",
"File",
"sb",
"=",
"new",
"File",
"(",
"configBackup",
",",
"Constants",
".",
"STANDALONE",
")",
";",
"backupDirectory",
"(",
"s",
",",
"sb",
")",
";",
"}",
"}"
] |
Backup the current configuration as part of the patch history.
@throws IOException for any error
|
[
"Backup",
"the",
"current",
"configuration",
"as",
"part",
"of",
"the",
"patch",
"history",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L975-L996
|
158,799 |
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
|
IdentityPatchContext.backupDirectory
|
static void backupDirectory(final File source, final File target) throws IOException {
if (!target.exists()) {
if (!target.mkdirs()) {
throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(target.getAbsolutePath());
}
}
final File[] files = source.listFiles(CONFIG_FILTER);
for (final File file : files) {
final File t = new File(target, file.getName());
IoUtils.copyFile(file, t);
}
}
|
java
|
static void backupDirectory(final File source, final File target) throws IOException {
if (!target.exists()) {
if (!target.mkdirs()) {
throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(target.getAbsolutePath());
}
}
final File[] files = source.listFiles(CONFIG_FILTER);
for (final File file : files) {
final File t = new File(target, file.getName());
IoUtils.copyFile(file, t);
}
}
|
[
"static",
"void",
"backupDirectory",
"(",
"final",
"File",
"source",
",",
"final",
"File",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"target",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"target",
".",
"mkdirs",
"(",
")",
")",
"{",
"throw",
"PatchLogger",
".",
"ROOT_LOGGER",
".",
"cannotCreateDirectory",
"(",
"target",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"}",
"final",
"File",
"[",
"]",
"files",
"=",
"source",
".",
"listFiles",
"(",
"CONFIG_FILTER",
")",
";",
"for",
"(",
"final",
"File",
"file",
":",
"files",
")",
"{",
"final",
"File",
"t",
"=",
"new",
"File",
"(",
"target",
",",
"file",
".",
"getName",
"(",
")",
")",
";",
"IoUtils",
".",
"copyFile",
"(",
"file",
",",
"t",
")",
";",
"}",
"}"
] |
Backup all xml files in a given directory.
@param source the source directory
@param target the target directory
@throws IOException for any error
|
[
"Backup",
"all",
"xml",
"files",
"in",
"a",
"given",
"directory",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L1013-L1024
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.