repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
wildfly/wildfly-core | deployment-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"... | 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 | train |
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",
".",
"ResourceIgnoredTransformationReg... | 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 | train |
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",
"<",
... | 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",
... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L116-L121 | train |
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",
"=",
... | 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 | train |
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",... | 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 | train |
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",... | 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 | train |
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",
";",... | 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 | train |
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",
"(",
")",
... | 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 | train |
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",
":",
"hostReso... | 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 | train |
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... | 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 | train |
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",
".",
... | 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"... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java#L231-L254 | train |
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",
"=",
"registerMode... | 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 | train |
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",
",",
"fal... | 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 | train |
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",
"Loca... | 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 | train |
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 | train |
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",
"(",
"p... | 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 | train |
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",
"="... | 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 | train |
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 oper... | 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 | train |
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",
... | 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",
"highl... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/RemoteDomainConnectionService.java#L670-L681 | train |
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",
".",
... | 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 | train |
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",
... | 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 | train |
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",
"{",
"persis... | 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 | train |
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",
... | 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 | train |
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 | train |
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 | train |
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"... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L98-L100 | train |
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",
"versio... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L109-L111 | train |
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 | train |
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",
... | 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 | train |
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",
... | 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 | train |
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",
... | 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 | train |
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 | train |
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",
".",... | 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 | train |
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 | train |
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 | train |
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",
"(",... | 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 | train |
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",
">",
... | 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 | train |
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",
".",
... | 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 | train |
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",... | 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 | train |
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",
"(",
... | 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 | train |
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",
"... | 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 | train |
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",
")",
"{",
... | 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 | train |
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",
... | 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 | train |
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",
"<",
"Pat... | 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 | train |
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 | train |
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",
"patch... | 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 | train |
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",
".",
... | 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 | train |
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",
"(",
")",
",",
"con... | 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 | train |
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",
"(",
")",
")... | 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 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java | IdentityPatchContext.writePatch | static void writePatch(final Patch rollbackPatch, final File file) throws IOException {
final File parent = file.getParentFile();
if (!parent.isDirectory()) {
if (!parent.mkdirs() && !parent.exists()) {
throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath());
}
}
try {
try (final OutputStream os = new FileOutputStream(file)){
PatchXml.marshal(os, rollbackPatch);
}
} catch (XMLStreamException e) {
throw new IOException(e);
}
} | java | static void writePatch(final Patch rollbackPatch, final File file) throws IOException {
final File parent = file.getParentFile();
if (!parent.isDirectory()) {
if (!parent.mkdirs() && !parent.exists()) {
throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath());
}
}
try {
try (final OutputStream os = new FileOutputStream(file)){
PatchXml.marshal(os, rollbackPatch);
}
} catch (XMLStreamException e) {
throw new IOException(e);
}
} | [
"static",
"void",
"writePatch",
"(",
"final",
"Patch",
"rollbackPatch",
",",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"final",
"File",
"parent",
"=",
"file",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"!",
"parent",
".",
"isDirector... | Write the patch.xml
@param rollbackPatch the patch
@param file the target file
@throws IOException | [
"Write",
"the",
"patch",
".",
"xml"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L1073-L1087 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java | CliCommandBuilder.setController | public CliCommandBuilder setController(final String hostname, final int port) {
setController(formatAddress(null, hostname, port));
return this;
} | java | public CliCommandBuilder setController(final String hostname, final int port) {
setController(formatAddress(null, hostname, port));
return this;
} | [
"public",
"CliCommandBuilder",
"setController",
"(",
"final",
"String",
"hostname",
",",
"final",
"int",
"port",
")",
"{",
"setController",
"(",
"formatAddress",
"(",
"null",
",",
"hostname",
",",
"port",
")",
")",
";",
"return",
"this",
";",
"}"
] | Sets the hostname and port to connect to.
@param hostname the host name
@param port the port
@return the builder | [
"Sets",
"the",
"hostname",
"and",
"port",
"to",
"connect",
"to",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java#L199-L202 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java | CliCommandBuilder.setController | public CliCommandBuilder setController(final String protocol, final String hostname, final int port) {
setController(formatAddress(protocol, hostname, port));
return this;
} | java | public CliCommandBuilder setController(final String protocol, final String hostname, final int port) {
setController(formatAddress(protocol, hostname, port));
return this;
} | [
"public",
"CliCommandBuilder",
"setController",
"(",
"final",
"String",
"protocol",
",",
"final",
"String",
"hostname",
",",
"final",
"int",
"port",
")",
"{",
"setController",
"(",
"formatAddress",
"(",
"protocol",
",",
"hostname",
",",
"port",
")",
")",
";",
... | Sets the protocol, hostname and port to connect to.
@param protocol the protocol to use
@param hostname the host name
@param port the port
@return the builder | [
"Sets",
"the",
"protocol",
"hostname",
"and",
"port",
"to",
"connect",
"to",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java#L213-L216 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java | CliCommandBuilder.setTimeout | public CliCommandBuilder setTimeout(final int timeout) {
if (timeout > 0) {
addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout));
} else {
addCliArgument(CliArgument.TIMEOUT, null);
}
return this;
} | java | public CliCommandBuilder setTimeout(final int timeout) {
if (timeout > 0) {
addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout));
} else {
addCliArgument(CliArgument.TIMEOUT, null);
}
return this;
} | [
"public",
"CliCommandBuilder",
"setTimeout",
"(",
"final",
"int",
"timeout",
")",
"{",
"if",
"(",
"timeout",
">",
"0",
")",
"{",
"addCliArgument",
"(",
"CliArgument",
".",
"TIMEOUT",
",",
"Integer",
".",
"toString",
"(",
"timeout",
")",
")",
";",
"}",
"e... | Sets the timeout used when connecting to the server.
@param timeout the time out to use
@return the builder | [
"Sets",
"the",
"timeout",
"used",
"when",
"connecting",
"to",
"the",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/CliCommandBuilder.java#L332-L339 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/Services.java | Services.addServerExecutorDependency | @Deprecated
public static <T> ServiceBuilder<T> addServerExecutorDependency(ServiceBuilder<T> builder, Injector<ExecutorService> injector) {
return builder.addDependency(ServerService.MANAGEMENT_EXECUTOR, ExecutorService.class, injector);
} | java | @Deprecated
public static <T> ServiceBuilder<T> addServerExecutorDependency(ServiceBuilder<T> builder, Injector<ExecutorService> injector) {
return builder.addDependency(ServerService.MANAGEMENT_EXECUTOR, ExecutorService.class, injector);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"ServiceBuilder",
"<",
"T",
">",
"addServerExecutorDependency",
"(",
"ServiceBuilder",
"<",
"T",
">",
"builder",
",",
"Injector",
"<",
"ExecutorService",
">",
"injector",
")",
"{",
"return",
"builder",
".",... | Creates dependency on management executor.
@param builder the builder
@param injector the injector
@param <T> the parameter type
@return service builder instance
@deprecated Use {@link #requireServerExecutor(ServiceBuilder)} instead. This method will be removed in the future. | [
"Creates",
"dependency",
"on",
"management",
"executor",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/Services.java#L84-L87 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.handleChannelClosed | public void handleChannelClosed(final Channel closed, final IOException e) {
for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) {
if (activeOperation.getChannel() == closed) {
// Only call cancel, to also interrupt still active threads
activeOperation.getResultHandler().cancel();
}
}
} | java | public void handleChannelClosed(final Channel closed, final IOException e) {
for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) {
if (activeOperation.getChannel() == closed) {
// Only call cancel, to also interrupt still active threads
activeOperation.getResultHandler().cancel();
}
}
} | [
"public",
"void",
"handleChannelClosed",
"(",
"final",
"Channel",
"closed",
",",
"final",
"IOException",
"e",
")",
"{",
"for",
"(",
"final",
"ActiveOperationImpl",
"<",
"?",
",",
"?",
">",
"activeOperation",
":",
"activeRequests",
".",
"values",
"(",
")",
")... | Receive a notification that the channel was closed.
This is used for the {@link ManagementClientChannelStrategy.Establishing} since it might use multiple channels.
@param closed the closed resource
@param e the exception which occurred during close, if any | [
"Receive",
"a",
"notification",
"that",
"the",
"channel",
"was",
"closed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L114-L121 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.awaitCompletion | @Override
public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException {
long deadline = unit.toMillis(timeout) + System.currentTimeMillis();
lock.lock(); try {
assert shutdown;
while(activeCount != 0) {
long remaining = deadline - System.currentTimeMillis();
if (remaining <= 0) {
break;
}
condition.await(remaining, TimeUnit.MILLISECONDS);
}
boolean allComplete = activeCount == 0;
if (!allComplete) {
ProtocolLogger.ROOT_LOGGER.debugf("ActiveOperation(s) %s have not completed within %d %s", activeRequests.keySet(), timeout, unit);
}
return allComplete;
} finally {
lock.unlock();
}
} | java | @Override
public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException {
long deadline = unit.toMillis(timeout) + System.currentTimeMillis();
lock.lock(); try {
assert shutdown;
while(activeCount != 0) {
long remaining = deadline - System.currentTimeMillis();
if (remaining <= 0) {
break;
}
condition.await(remaining, TimeUnit.MILLISECONDS);
}
boolean allComplete = activeCount == 0;
if (!allComplete) {
ProtocolLogger.ROOT_LOGGER.debugf("ActiveOperation(s) %s have not completed within %d %s", activeRequests.keySet(), timeout, unit);
}
return allComplete;
} finally {
lock.unlock();
}
} | [
"@",
"Override",
"public",
"boolean",
"awaitCompletion",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"long",
"deadline",
"=",
"unit",
".",
"toMillis",
"(",
"timeout",
")",
"+",
"System",
".",
"currentTimeMillis",
... | Await the completion of all currently active operations.
@param timeout the timeout
@param unit the time unit
@return {@code } false if the timeout was reached and there were still active operations
@throws InterruptedException | [
"Await",
"the",
"completion",
"of",
"all",
"currently",
"active",
"operations",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L161-L181 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.registerActiveOperation | protected <T, A> ActiveOperation<T, A> registerActiveOperation(final Integer id, A attachment, ActiveOperation.CompletedCallback<T> callback) {
lock.lock();
try {
// Check that we still allow registration
// TODO WFCORE-199 distinguish client uses from server uses and limit this check to server uses
// Using id==null may be one way to do this, but we need to consider ops that involve multiple requests
// TODO WFCORE-845 consider using an IllegalStateException for this
//assert ! shutdown;
final Integer operationId;
if(id == null) {
// If we did not get an operationId, create a new one
operationId = operationIdManager.createBatchId();
} else {
// Check that the operationId is not already taken
if(! operationIdManager.lockBatchId(id)) {
throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(id);
}
operationId = id;
}
final ActiveOperationImpl<T, A> request = new ActiveOperationImpl<T, A>(operationId, attachment, getCheckedCallback(callback), this);
final ActiveOperation<?, ?> existing = activeRequests.putIfAbsent(operationId, request);
if(existing != null) {
throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(operationId);
}
ProtocolLogger.ROOT_LOGGER.tracef("Registered active operation %d", operationId);
activeCount++; // condition.signalAll();
return request;
} finally {
lock.unlock();
}
} | java | protected <T, A> ActiveOperation<T, A> registerActiveOperation(final Integer id, A attachment, ActiveOperation.CompletedCallback<T> callback) {
lock.lock();
try {
// Check that we still allow registration
// TODO WFCORE-199 distinguish client uses from server uses and limit this check to server uses
// Using id==null may be one way to do this, but we need to consider ops that involve multiple requests
// TODO WFCORE-845 consider using an IllegalStateException for this
//assert ! shutdown;
final Integer operationId;
if(id == null) {
// If we did not get an operationId, create a new one
operationId = operationIdManager.createBatchId();
} else {
// Check that the operationId is not already taken
if(! operationIdManager.lockBatchId(id)) {
throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(id);
}
operationId = id;
}
final ActiveOperationImpl<T, A> request = new ActiveOperationImpl<T, A>(operationId, attachment, getCheckedCallback(callback), this);
final ActiveOperation<?, ?> existing = activeRequests.putIfAbsent(operationId, request);
if(existing != null) {
throw ProtocolLogger.ROOT_LOGGER.operationIdAlreadyExists(operationId);
}
ProtocolLogger.ROOT_LOGGER.tracef("Registered active operation %d", operationId);
activeCount++; // condition.signalAll();
return request;
} finally {
lock.unlock();
}
} | [
"protected",
"<",
"T",
",",
"A",
">",
"ActiveOperation",
"<",
"T",
",",
"A",
">",
"registerActiveOperation",
"(",
"final",
"Integer",
"id",
",",
"A",
"attachment",
",",
"ActiveOperation",
".",
"CompletedCallback",
"<",
"T",
">",
"callback",
")",
"{",
"lock... | Register an active operation with a specific operation id.
@param id the operation id
@param attachment the shared attachment
@param callback the completed callback
@return the created active operation
@throws java.lang.IllegalStateException if an operation with the same id is already registered | [
"Register",
"an",
"active",
"operation",
"with",
"a",
"specific",
"operation",
"id",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L380-L410 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.getActiveOperation | protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) {
return getActiveOperation(header.getBatchId());
} | java | protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) {
return getActiveOperation(header.getBatchId());
} | [
"protected",
"<",
"T",
",",
"A",
">",
"ActiveOperation",
"<",
"T",
",",
"A",
">",
"getActiveOperation",
"(",
"final",
"ManagementRequestHeader",
"header",
")",
"{",
"return",
"getActiveOperation",
"(",
"header",
".",
"getBatchId",
"(",
")",
")",
";",
"}"
] | Get an active operation.
@param header the request header
@return the active operation, {@code null} if if there is no registered operation | [
"Get",
"an",
"active",
"operation",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L418-L420 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.getActiveOperation | protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) {
//noinspection unchecked
return (ActiveOperation<T, A>) activeRequests.get(id);
} | java | protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) {
//noinspection unchecked
return (ActiveOperation<T, A>) activeRequests.get(id);
} | [
"protected",
"<",
"T",
",",
"A",
">",
"ActiveOperation",
"<",
"T",
",",
"A",
">",
"getActiveOperation",
"(",
"final",
"Integer",
"id",
")",
"{",
"//noinspection unchecked",
"return",
"(",
"ActiveOperation",
"<",
"T",
",",
"A",
">",
")",
"activeRequests",
"... | Get the active operation.
@param id the active operation id
@return the active operation, {@code null} if if there is no registered operation | [
"Get",
"the",
"active",
"operation",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L428-L431 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.cancelAllActiveOperations | protected List<Integer> cancelAllActiveOperations() {
final List<Integer> operations = new ArrayList<Integer>();
for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) {
activeOperation.asyncCancel(false);
operations.add(activeOperation.getOperationId());
}
return operations;
} | java | protected List<Integer> cancelAllActiveOperations() {
final List<Integer> operations = new ArrayList<Integer>();
for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) {
activeOperation.asyncCancel(false);
operations.add(activeOperation.getOperationId());
}
return operations;
} | [
"protected",
"List",
"<",
"Integer",
">",
"cancelAllActiveOperations",
"(",
")",
"{",
"final",
"List",
"<",
"Integer",
">",
"operations",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"final",
"ActiveOperationImpl",
"<",
"?",
","... | Cancel all currently active operations.
@return a list of cancelled operations | [
"Cancel",
"all",
"currently",
"active",
"operations",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L438-L445 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.removeActiveOperation | protected <T, A> ActiveOperation<T, A> removeActiveOperation(Integer id) {
final ActiveOperation<T, A> removed = removeUnderLock(id);
if(removed != null) {
for(final Map.Entry<Integer, ActiveRequest<?, ?>> requestEntry : requests.entrySet()) {
final ActiveRequest<?, ?> request = requestEntry.getValue();
if(request.context == removed) {
requests.remove(requestEntry.getKey());
}
}
}
return removed;
} | java | protected <T, A> ActiveOperation<T, A> removeActiveOperation(Integer id) {
final ActiveOperation<T, A> removed = removeUnderLock(id);
if(removed != null) {
for(final Map.Entry<Integer, ActiveRequest<?, ?>> requestEntry : requests.entrySet()) {
final ActiveRequest<?, ?> request = requestEntry.getValue();
if(request.context == removed) {
requests.remove(requestEntry.getKey());
}
}
}
return removed;
} | [
"protected",
"<",
"T",
",",
"A",
">",
"ActiveOperation",
"<",
"T",
",",
"A",
">",
"removeActiveOperation",
"(",
"Integer",
"id",
")",
"{",
"final",
"ActiveOperation",
"<",
"T",
",",
"A",
">",
"removed",
"=",
"removeUnderLock",
"(",
"id",
")",
";",
"if"... | Remove an active operation.
@param id the operation id
@return the removed active operation, {@code null} if there was no registered operation | [
"Remove",
"an",
"active",
"operation",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L453-L464 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.safeWriteErrorResponse | protected static void safeWriteErrorResponse(final Channel channel, final ManagementProtocolHeader header, final Throwable error) {
if(header.getType() == ManagementProtocol.TYPE_REQUEST) {
try {
writeErrorResponse(channel, (ManagementRequestHeader) header, error);
} catch(IOException ioe) {
ProtocolLogger.ROOT_LOGGER.tracef(ioe, "failed to write error response for %s on channel: %s", header, channel);
}
}
} | java | protected static void safeWriteErrorResponse(final Channel channel, final ManagementProtocolHeader header, final Throwable error) {
if(header.getType() == ManagementProtocol.TYPE_REQUEST) {
try {
writeErrorResponse(channel, (ManagementRequestHeader) header, error);
} catch(IOException ioe) {
ProtocolLogger.ROOT_LOGGER.tracef(ioe, "failed to write error response for %s on channel: %s", header, channel);
}
}
} | [
"protected",
"static",
"void",
"safeWriteErrorResponse",
"(",
"final",
"Channel",
"channel",
",",
"final",
"ManagementProtocolHeader",
"header",
",",
"final",
"Throwable",
"error",
")",
"{",
"if",
"(",
"header",
".",
"getType",
"(",
")",
"==",
"ManagementProtocol"... | Safe write error response.
@param channel the channel
@param header the request header
@param error the exception | [
"Safe",
"write",
"error",
"response",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L489-L497 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.writeErrorResponse | protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException {
final ManagementResponseHeader response = ManagementResponseHeader.create(header, error);
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | java | protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException {
final ManagementResponseHeader response = ManagementResponseHeader.create(header, error);
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | [
"protected",
"static",
"void",
"writeErrorResponse",
"(",
"final",
"Channel",
"channel",
",",
"final",
"ManagementRequestHeader",
"header",
",",
"final",
"Throwable",
"error",
")",
"throws",
"IOException",
"{",
"final",
"ManagementResponseHeader",
"response",
"=",
"Ma... | Write an error response.
@param channel the channel
@param header the request
@param error the error
@throws IOException | [
"Write",
"an",
"error",
"response",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L507-L516 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.writeHeader | protected static FlushableDataOutput writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException {
final FlushableDataOutput output = FlushableDataOutputImpl.create(os);
header.write(output);
return output;
} | java | protected static FlushableDataOutput writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException {
final FlushableDataOutput output = FlushableDataOutputImpl.create(os);
header.write(output);
return output;
} | [
"protected",
"static",
"FlushableDataOutput",
"writeHeader",
"(",
"final",
"ManagementProtocolHeader",
"header",
",",
"final",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"final",
"FlushableDataOutput",
"output",
"=",
"FlushableDataOutputImpl",
".",
"create",... | Write the management protocol header.
@param header the mgmt protocol header
@param os the output stream
@throws IOException | [
"Write",
"the",
"management",
"protocol",
"header",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L525-L529 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java | AbstractMessageHandler.getFallbackHandler | protected static <T, A> ManagementRequestHandler<T, A> getFallbackHandler(final ManagementRequestHeader header) {
return new ManagementRequestHandler<T, A>() {
@Override
public void handleRequest(final DataInput input, ActiveOperation.ResultHandler<T> resultHandler, ManagementRequestContext<A> context) throws IOException {
final Exception error = ProtocolLogger.ROOT_LOGGER.noSuchResponseHandler(Integer.toHexString(header.getRequestId()));
if(resultHandler.failed(error)) {
safeWriteErrorResponse(context.getChannel(), context.getRequestHeader(), error);
}
}
};
} | java | protected static <T, A> ManagementRequestHandler<T, A> getFallbackHandler(final ManagementRequestHeader header) {
return new ManagementRequestHandler<T, A>() {
@Override
public void handleRequest(final DataInput input, ActiveOperation.ResultHandler<T> resultHandler, ManagementRequestContext<A> context) throws IOException {
final Exception error = ProtocolLogger.ROOT_LOGGER.noSuchResponseHandler(Integer.toHexString(header.getRequestId()));
if(resultHandler.failed(error)) {
safeWriteErrorResponse(context.getChannel(), context.getRequestHeader(), error);
}
}
};
} | [
"protected",
"static",
"<",
"T",
",",
"A",
">",
"ManagementRequestHandler",
"<",
"T",
",",
"A",
">",
"getFallbackHandler",
"(",
"final",
"ManagementRequestHeader",
"header",
")",
"{",
"return",
"new",
"ManagementRequestHandler",
"<",
"T",
",",
"A",
">",
"(",
... | Get a fallback handler.
@param header the protocol header
@return the fallback handler | [
"Get",
"a",
"fallback",
"handler",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L537-L547 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.processFile | static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException {
if (mode == PatchingTaskContext.Mode.APPLY) {
if (ENABLE_INVALIDATION) {
updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG);
backup(context, file);
}
} else if (mode == PatchingTaskContext.Mode.ROLLBACK) {
updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG);
restore(context, file);
} else {
throw new IllegalStateException();
}
} | java | static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException {
if (mode == PatchingTaskContext.Mode.APPLY) {
if (ENABLE_INVALIDATION) {
updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_ENDSIG);
backup(context, file);
}
} else if (mode == PatchingTaskContext.Mode.ROLLBACK) {
updateJar(file, CRIPPLED_ENDSIG_PATTERN, BAD_BYTE_SKIP, GOOD_ENDSIG, CRIPPLED_ENDSIG);
restore(context, file);
} else {
throw new IllegalStateException();
}
} | [
"static",
"void",
"processFile",
"(",
"final",
"IdentityPatchContext",
"context",
",",
"final",
"File",
"file",
",",
"final",
"PatchingTaskContext",
".",
"Mode",
"mode",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mode",
"==",
"PatchingTaskContext",
".",
"Mod... | Process a file.
@param file the file to be processed
@param mode the patching mode
@throws IOException | [
"Process",
"a",
"file",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L150-L162 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.updateJar | private static void updateJar(final File file, final byte[] searchPattern, final int[] badSkipBytes, final int newSig, final int endSig) throws IOException {
final RandomAccessFile raf = new RandomAccessFile(file, "rw");
try {
final FileChannel channel = raf.getChannel();
try {
long pos = channel.size() - ENDLEN;
final ScanContext context;
if (newSig == CRIPPLED_ENDSIG) {
context = new ScanContext(GOOD_ENDSIG_PATTERN, CRIPPLED_ENDSIG_PATTERN);
} else if (newSig == GOOD_ENDSIG) {
context = new ScanContext(CRIPPLED_ENDSIG_PATTERN, GOOD_ENDSIG_PATTERN);
} else {
context = null;
}
if (!validateEndRecord(file, channel, pos, endSig)) {
pos = scanForEndSig(file, channel, context);
}
if (pos == -1) {
if (context.state == State.NOT_FOUND) {
// Don't fail patching if we cannot validate a valid zip
PatchLogger.ROOT_LOGGER.cannotInvalidateZip(file.getAbsolutePath());
}
return;
}
// Update the central directory record
channel.position(pos);
final ByteBuffer buffer = ByteBuffer.allocate(4);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(newSig);
buffer.flip();
while (buffer.hasRemaining()) {
channel.write(buffer);
}
} finally {
safeClose(channel);
}
} finally {
safeClose(raf);
}
} | java | private static void updateJar(final File file, final byte[] searchPattern, final int[] badSkipBytes, final int newSig, final int endSig) throws IOException {
final RandomAccessFile raf = new RandomAccessFile(file, "rw");
try {
final FileChannel channel = raf.getChannel();
try {
long pos = channel.size() - ENDLEN;
final ScanContext context;
if (newSig == CRIPPLED_ENDSIG) {
context = new ScanContext(GOOD_ENDSIG_PATTERN, CRIPPLED_ENDSIG_PATTERN);
} else if (newSig == GOOD_ENDSIG) {
context = new ScanContext(CRIPPLED_ENDSIG_PATTERN, GOOD_ENDSIG_PATTERN);
} else {
context = null;
}
if (!validateEndRecord(file, channel, pos, endSig)) {
pos = scanForEndSig(file, channel, context);
}
if (pos == -1) {
if (context.state == State.NOT_FOUND) {
// Don't fail patching if we cannot validate a valid zip
PatchLogger.ROOT_LOGGER.cannotInvalidateZip(file.getAbsolutePath());
}
return;
}
// Update the central directory record
channel.position(pos);
final ByteBuffer buffer = ByteBuffer.allocate(4);
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(newSig);
buffer.flip();
while (buffer.hasRemaining()) {
channel.write(buffer);
}
} finally {
safeClose(channel);
}
} finally {
safeClose(raf);
}
} | [
"private",
"static",
"void",
"updateJar",
"(",
"final",
"File",
"file",
",",
"final",
"byte",
"[",
"]",
"searchPattern",
",",
"final",
"int",
"[",
"]",
"badSkipBytes",
",",
"final",
"int",
"newSig",
",",
"final",
"int",
"endSig",
")",
"throws",
"IOExceptio... | Update the central directory signature of a .jar.
@param file the file to process
@param searchPattern the search patter to use
@param badSkipBytes the bad bytes skip table
@param newSig the new signature
@param endSig the expected signature
@throws IOException | [
"Update",
"the",
"central",
"directory",
"signature",
"of",
"a",
".",
"jar",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L174-L214 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.validateEndRecord | private static boolean validateEndRecord(File file, FileChannel channel, long startEndRecord, long endSig) throws IOException {
try {
channel.position(startEndRecord);
final ByteBuffer endDirHeader = getByteBuffer(ENDLEN);
read(endDirHeader, channel);
if (endDirHeader.limit() < ENDLEN) {
// Couldn't read the full end of central directory record header
return false;
} else if (getUnsignedInt(endDirHeader, 0) != endSig) {
return false;
}
long pos = getUnsignedInt(endDirHeader, END_CENSTART);
// TODO deal with Zip64
if (pos == ZIP64_MARKER) {
return false;
}
ByteBuffer cdfhBuffer = getByteBuffer(CENLEN);
read(cdfhBuffer, channel, pos);
long header = getUnsignedInt(cdfhBuffer, 0);
if (header == CENSIG) {
long firstLoc = getUnsignedInt(cdfhBuffer, CEN_LOC_OFFSET);
long firstSize = getUnsignedInt(cdfhBuffer, CENSIZ);
if (firstLoc == 0) {
// normal case -- first bytes are the first local file
if (!validateLocalFileRecord(channel, 0, firstSize)) {
return false;
}
} else {
// confirm that firstLoc is indeed the first local file
long fileFirstLoc = scanForLocSig(channel);
if (firstLoc != fileFirstLoc) {
if (fileFirstLoc == 0) {
return false;
} else {
// scanForLocSig() found a LOCSIG, but not at position zero and not
// at the expected position.
// With a file like this, we can't tell if we're in a nested zip
// or we're in an outer zip and had the bad luck to find random bytes
// that look like LOCSIG.
return false;
}
}
}
// At this point, endDirHeader points to the correct end of central dir record.
// Just need to validate the record is complete, including any comment
int commentLen = getUnsignedShort(endDirHeader, END_COMMENTLEN);
long commentEnd = startEndRecord + ENDLEN + commentLen;
return commentEnd <= channel.size();
}
return false;
} catch (EOFException eof) {
// pos or firstLoc weren't really positions and moved us to an invalid location
return false;
}
} | java | private static boolean validateEndRecord(File file, FileChannel channel, long startEndRecord, long endSig) throws IOException {
try {
channel.position(startEndRecord);
final ByteBuffer endDirHeader = getByteBuffer(ENDLEN);
read(endDirHeader, channel);
if (endDirHeader.limit() < ENDLEN) {
// Couldn't read the full end of central directory record header
return false;
} else if (getUnsignedInt(endDirHeader, 0) != endSig) {
return false;
}
long pos = getUnsignedInt(endDirHeader, END_CENSTART);
// TODO deal with Zip64
if (pos == ZIP64_MARKER) {
return false;
}
ByteBuffer cdfhBuffer = getByteBuffer(CENLEN);
read(cdfhBuffer, channel, pos);
long header = getUnsignedInt(cdfhBuffer, 0);
if (header == CENSIG) {
long firstLoc = getUnsignedInt(cdfhBuffer, CEN_LOC_OFFSET);
long firstSize = getUnsignedInt(cdfhBuffer, CENSIZ);
if (firstLoc == 0) {
// normal case -- first bytes are the first local file
if (!validateLocalFileRecord(channel, 0, firstSize)) {
return false;
}
} else {
// confirm that firstLoc is indeed the first local file
long fileFirstLoc = scanForLocSig(channel);
if (firstLoc != fileFirstLoc) {
if (fileFirstLoc == 0) {
return false;
} else {
// scanForLocSig() found a LOCSIG, but not at position zero and not
// at the expected position.
// With a file like this, we can't tell if we're in a nested zip
// or we're in an outer zip and had the bad luck to find random bytes
// that look like LOCSIG.
return false;
}
}
}
// At this point, endDirHeader points to the correct end of central dir record.
// Just need to validate the record is complete, including any comment
int commentLen = getUnsignedShort(endDirHeader, END_COMMENTLEN);
long commentEnd = startEndRecord + ENDLEN + commentLen;
return commentEnd <= channel.size();
}
return false;
} catch (EOFException eof) {
// pos or firstLoc weren't really positions and moved us to an invalid location
return false;
}
} | [
"private",
"static",
"boolean",
"validateEndRecord",
"(",
"File",
"file",
",",
"FileChannel",
"channel",
",",
"long",
"startEndRecord",
",",
"long",
"endSig",
")",
"throws",
"IOException",
"{",
"try",
"{",
"channel",
".",
"position",
"(",
"startEndRecord",
")",
... | Validates that the data structure at position startEndRecord has a field in the expected position
that points to the start of the first central directory file, and, if so, that the file
has a complete end of central directory record comment at the end.
@param file the file being checked
@param channel the channel
@param startEndRecord the start of the end of central directory record
@param endSig the end of central dir signature
@return true if it can be confirmed that the end of directory record points to a central directory
file and a complete comment is present, false otherwise
@throws java.io.IOException | [
"Validates",
"that",
"the",
"data",
"structure",
"at",
"position",
"startEndRecord",
"has",
"a",
"field",
"in",
"the",
"expected",
"position",
"that",
"points",
"to",
"the",
"start",
"of",
"the",
"first",
"central",
"directory",
"file",
"and",
"if",
"so",
"t... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L257-L317 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.scanForEndSig | private static long scanForEndSig(final File file, final FileChannel channel, final ScanContext context) throws IOException {
// TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex
ByteBuffer bb = getByteBuffer(CHUNK_SIZE);
long start = channel.size();
long end = Math.max(0, start - MAX_REVERSE_SCAN);
long channelPos = Math.max(0, start - CHUNK_SIZE);
long lastChannelPos = channelPos;
while (lastChannelPos >= end) {
read(bb, channel, channelPos);
int actualRead = bb.limit();
int bufferPos = actualRead - 1;
while (bufferPos >= SIG_PATTERN_LENGTH) {
// Following is based on the Boyer Moore algorithm but simplified to reflect
// a) the pattern is static
// b) the pattern has no repeating bytes
int patternPos;
for (patternPos = SIG_PATTERN_LENGTH - 1;
patternPos >= 0 && context.matches(patternPos, bb.get(bufferPos - patternPos));
--patternPos) {
// empty loop while bytes match
}
// Switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm
switch (patternPos) {
case -1: {
final State state = context.state;
// Pattern matched. Confirm is this is the start of a valid end of central dir record
long startEndRecord = channelPos + bufferPos - SIG_PATTERN_LENGTH + 1;
if (validateEndRecord(file, channel, startEndRecord, context.getSig())) {
if (state == State.FOUND) {
return startEndRecord;
} else {
return -1;
}
}
// wasn't a valid end record; continue scan
bufferPos -= 4;
break;
}
case 3: {
// No bytes matched; the common case.
// With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may
// produce a shift greater than the "good suffix array" (which would shift 1 byte)
int idx = bb.get(bufferPos - patternPos) - Byte.MIN_VALUE;
bufferPos -= BAD_BYTE_SKIP[idx];
break;
}
default:
// 1 or more bytes matched
bufferPos -= 4;
}
}
// Move back a full chunk. If we didn't read a full chunk, that's ok,
// it means we read all data and the outer while loop will terminate
if (channelPos <= bufferPos) {
break;
}
lastChannelPos = channelPos;
channelPos -= Math.min(channelPos - bufferPos, CHUNK_SIZE - bufferPos);
}
return -1;
} | java | private static long scanForEndSig(final File file, final FileChannel channel, final ScanContext context) throws IOException {
// TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex
ByteBuffer bb = getByteBuffer(CHUNK_SIZE);
long start = channel.size();
long end = Math.max(0, start - MAX_REVERSE_SCAN);
long channelPos = Math.max(0, start - CHUNK_SIZE);
long lastChannelPos = channelPos;
while (lastChannelPos >= end) {
read(bb, channel, channelPos);
int actualRead = bb.limit();
int bufferPos = actualRead - 1;
while (bufferPos >= SIG_PATTERN_LENGTH) {
// Following is based on the Boyer Moore algorithm but simplified to reflect
// a) the pattern is static
// b) the pattern has no repeating bytes
int patternPos;
for (patternPos = SIG_PATTERN_LENGTH - 1;
patternPos >= 0 && context.matches(patternPos, bb.get(bufferPos - patternPos));
--patternPos) {
// empty loop while bytes match
}
// Switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm
switch (patternPos) {
case -1: {
final State state = context.state;
// Pattern matched. Confirm is this is the start of a valid end of central dir record
long startEndRecord = channelPos + bufferPos - SIG_PATTERN_LENGTH + 1;
if (validateEndRecord(file, channel, startEndRecord, context.getSig())) {
if (state == State.FOUND) {
return startEndRecord;
} else {
return -1;
}
}
// wasn't a valid end record; continue scan
bufferPos -= 4;
break;
}
case 3: {
// No bytes matched; the common case.
// With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may
// produce a shift greater than the "good suffix array" (which would shift 1 byte)
int idx = bb.get(bufferPos - patternPos) - Byte.MIN_VALUE;
bufferPos -= BAD_BYTE_SKIP[idx];
break;
}
default:
// 1 or more bytes matched
bufferPos -= 4;
}
}
// Move back a full chunk. If we didn't read a full chunk, that's ok,
// it means we read all data and the outer while loop will terminate
if (channelPos <= bufferPos) {
break;
}
lastChannelPos = channelPos;
channelPos -= Math.min(channelPos - bufferPos, CHUNK_SIZE - bufferPos);
}
return -1;
} | [
"private",
"static",
"long",
"scanForEndSig",
"(",
"final",
"File",
"file",
",",
"final",
"FileChannel",
"channel",
",",
"final",
"ScanContext",
"context",
")",
"throws",
"IOException",
"{",
"// TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cos... | Boyer Moore scan that proceeds backwards from the end of the file looking for endsig
@param file the file being checked
@param channel the channel
@param context the scan context
@return
@throws IOException | [
"Boyer",
"Moore",
"scan",
"that",
"proceeds",
"backwards",
"from",
"the",
"end",
"of",
"the",
"file",
"looking",
"for",
"endsig"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L328-L399 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.scanForLocSig | private static long scanForLocSig(FileChannel channel) throws IOException {
channel.position(0);
ByteBuffer bb = getByteBuffer(CHUNK_SIZE);
long end = channel.size();
while (channel.position() <= end) {
read(bb, channel);
int bufferPos = 0;
while (bufferPos <= bb.limit() - SIG_PATTERN_LENGTH) {
// Following is based on the Boyer Moore algorithm but simplified to reflect
// a) the size of the pattern is static
// b) the pattern is static and has no repeating bytes
int patternPos;
for (patternPos = SIG_PATTERN_LENGTH - 1;
patternPos >= 0 && LOCSIG_PATTERN[patternPos] == bb.get(bufferPos + patternPos);
--patternPos) {
// empty loop while bytes match
}
// Outer switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm
switch (patternPos) {
case -1: {
// Pattern matched. Confirm is this is the start of a valid local file record
long startLocRecord = channel.position() - bb.limit() + bufferPos;
long currentPos = channel.position();
if (validateLocalFileRecord(channel, startLocRecord, -1)) {
return startLocRecord;
}
// Restore position in case it shifted
channel.position(currentPos);
// wasn't a valid local file record; continue scan
bufferPos += 4;
break;
}
case 3: {
// No bytes matched; the common case.
// With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may
// produce a shift greater than the "good suffix array" (which would shift 1 byte)
int idx = bb.get(bufferPos + patternPos) - Byte.MIN_VALUE;
bufferPos += LOC_BAD_BYTE_SKIP[idx];
break;
}
default:
// 1 or more bytes matched
bufferPos += 4;
}
}
}
return -1;
} | java | private static long scanForLocSig(FileChannel channel) throws IOException {
channel.position(0);
ByteBuffer bb = getByteBuffer(CHUNK_SIZE);
long end = channel.size();
while (channel.position() <= end) {
read(bb, channel);
int bufferPos = 0;
while (bufferPos <= bb.limit() - SIG_PATTERN_LENGTH) {
// Following is based on the Boyer Moore algorithm but simplified to reflect
// a) the size of the pattern is static
// b) the pattern is static and has no repeating bytes
int patternPos;
for (patternPos = SIG_PATTERN_LENGTH - 1;
patternPos >= 0 && LOCSIG_PATTERN[patternPos] == bb.get(bufferPos + patternPos);
--patternPos) {
// empty loop while bytes match
}
// Outer switch gives same results as checking the "good suffix array" in the Boyer Moore algorithm
switch (patternPos) {
case -1: {
// Pattern matched. Confirm is this is the start of a valid local file record
long startLocRecord = channel.position() - bb.limit() + bufferPos;
long currentPos = channel.position();
if (validateLocalFileRecord(channel, startLocRecord, -1)) {
return startLocRecord;
}
// Restore position in case it shifted
channel.position(currentPos);
// wasn't a valid local file record; continue scan
bufferPos += 4;
break;
}
case 3: {
// No bytes matched; the common case.
// With our pattern, this is the only case where the Boyer Moore algorithm's "bad char array" may
// produce a shift greater than the "good suffix array" (which would shift 1 byte)
int idx = bb.get(bufferPos + patternPos) - Byte.MIN_VALUE;
bufferPos += LOC_BAD_BYTE_SKIP[idx];
break;
}
default:
// 1 or more bytes matched
bufferPos += 4;
}
}
}
return -1;
} | [
"private",
"static",
"long",
"scanForLocSig",
"(",
"FileChannel",
"channel",
")",
"throws",
"IOException",
"{",
"channel",
".",
"position",
"(",
"0",
")",
";",
"ByteBuffer",
"bb",
"=",
"getByteBuffer",
"(",
"CHUNK_SIZE",
")",
";",
"long",
"end",
"=",
"channe... | Boyer Moore scan that proceeds forwards from the end of the file looking for the first LOCSIG | [
"Boyer",
"Moore",
"scan",
"that",
"proceeds",
"forwards",
"from",
"the",
"end",
"of",
"the",
"file",
"looking",
"for",
"the",
"first",
"LOCSIG"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L404-L460 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.validateLocalFileRecord | private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException {
ByteBuffer lfhBuffer = getByteBuffer(LOCLEN);
read(lfhBuffer, channel, startLocRecord);
if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) {
return false;
}
if (compressedSize == -1) {
// We can't further evaluate
return true;
}
int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN);
int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN);
long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen;
read(lfhBuffer, channel, nextSigPos);
long header = getUnsignedInt(lfhBuffer, 0);
return header == LOCSIG || header == EXTSIG || header == CENSIG;
} | java | private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException {
ByteBuffer lfhBuffer = getByteBuffer(LOCLEN);
read(lfhBuffer, channel, startLocRecord);
if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) {
return false;
}
if (compressedSize == -1) {
// We can't further evaluate
return true;
}
int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN);
int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN);
long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen;
read(lfhBuffer, channel, nextSigPos);
long header = getUnsignedInt(lfhBuffer, 0);
return header == LOCSIG || header == EXTSIG || header == CENSIG;
} | [
"private",
"static",
"boolean",
"validateLocalFileRecord",
"(",
"FileChannel",
"channel",
",",
"long",
"startLocRecord",
",",
"long",
"compressedSize",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"lfhBuffer",
"=",
"getByteBuffer",
"(",
"LOCLEN",
")",
";",
"read... | Checks that the data starting at startLocRecord looks like a local file record header.
@param channel the channel
@param startLocRecord offset into channel of the start of the local record
@param compressedSize expected compressed size of the file, or -1 to indicate this isn't known | [
"Checks",
"that",
"the",
"data",
"starting",
"at",
"startLocRecord",
"looks",
"like",
"a",
"local",
"file",
"record",
"header",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L469-L489 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.computeBadByteSkipArray | private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) {
for (int a = 0; a < ALPHABET_SIZE; a++) {
badByteArray[a] = pattern.length;
}
for (int j = 0; j < pattern.length - 1; j++) {
badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1;
}
} | java | private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) {
for (int a = 0; a < ALPHABET_SIZE; a++) {
badByteArray[a] = pattern.length;
}
for (int j = 0; j < pattern.length - 1; j++) {
badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1;
}
} | [
"private",
"static",
"void",
"computeBadByteSkipArray",
"(",
"byte",
"[",
"]",
"pattern",
",",
"int",
"[",
"]",
"badByteArray",
")",
"{",
"for",
"(",
"int",
"a",
"=",
"0",
";",
"a",
"<",
"ALPHABET_SIZE",
";",
"a",
"++",
")",
"{",
"badByteArray",
"[",
... | Fills the Boyer Moore "bad character array" for the given pattern | [
"Fills",
"the",
"Boyer",
"Moore",
"bad",
"character",
"array",
"for",
"the",
"given",
"pattern"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L520-L528 | train |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java | EmbeddedProcessFactory.createHostController | public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) {
if (jbossHomePath == null || jbossHomePath.isEmpty()) {
throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath);
}
File jbossHomeDir = new File(jbossHomePath);
if (!jbossHomeDir.isDirectory()) {
throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath);
}
return createHostController(
Configuration.Builder.of(jbossHomeDir)
.setModulePath(modulePath)
.setSystemPackages(systemPackages)
.setCommandArguments(cmdargs)
.build()
);
} | java | public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) {
if (jbossHomePath == null || jbossHomePath.isEmpty()) {
throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath);
}
File jbossHomeDir = new File(jbossHomePath);
if (!jbossHomeDir.isDirectory()) {
throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath);
}
return createHostController(
Configuration.Builder.of(jbossHomeDir)
.setModulePath(modulePath)
.setSystemPackages(systemPackages)
.setCommandArguments(cmdargs)
.build()
);
} | [
"public",
"static",
"HostController",
"createHostController",
"(",
"String",
"jbossHomePath",
",",
"String",
"modulePath",
",",
"String",
"[",
"]",
"systemPackages",
",",
"String",
"[",
"]",
"cmdargs",
")",
"{",
"if",
"(",
"jbossHomePath",
"==",
"null",
"||",
... | Create an embedded host controller.
@param jbossHomePath the location of the root of the host controller installation. Cannot be {@code null} or empty.
@param modulePath the location of the root of the module repository. May be {@code null} if the standard
location under {@code jbossHomePath} should be used
@param systemPackages names of any packages that must be treated as system packages, with the same classes
visible to the caller's classloader visible to host-controller-side classes loaded from
the server's modular classloader
@param cmdargs any additional arguments to pass to the embedded host controller (e.g. -b=192.168.100.10)
@return the server. Will not be {@code null} | [
"Create",
"an",
"embedded",
"host",
"controller",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java#L206-L221 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorDependencyProcessor.java | ServiceActivatorDependencyProcessor.deploy | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT);
final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment(
Attachments.MODULE_SPECIFICATION);
if(deploymentRoot == null)
return;
final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES);
if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
moduleSpecification.addSystemDependency(MSC_DEP);
}
} | java | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT);
final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment(
Attachments.MODULE_SPECIFICATION);
if(deploymentRoot == null)
return;
final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES);
if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
moduleSpecification.addSystemDependency(MSC_DEP);
}
} | [
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"ResourceRoot",
"deploymentRoot",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
".",
"getAttachment",
"(",
"Attachments"... | Add the dependencies if the deployment contains a service activator loader entry.
@param phaseContext the deployment unit context
@throws DeploymentUnitProcessingException | [
"Add",
"the",
"dependencies",
"if",
"the",
"deployment",
"contains",
"a",
"service",
"activator",
"loader",
"entry",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorDependencyProcessor.java#L52-L62 | train |
wildfly/wildfly-core | request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java | ControlPoint.pause | public void pause(ServerActivityCallback requestCountListener) {
if (paused) {
throw ServerLogger.ROOT_LOGGER.serverAlreadyPaused();
}
this.paused = true;
listenerUpdater.set(this, requestCountListener);
if (activeRequestCountUpdater.get(this) == 0) {
if (listenerUpdater.compareAndSet(this, requestCountListener, null)) {
requestCountListener.done();
}
}
} | java | public void pause(ServerActivityCallback requestCountListener) {
if (paused) {
throw ServerLogger.ROOT_LOGGER.serverAlreadyPaused();
}
this.paused = true;
listenerUpdater.set(this, requestCountListener);
if (activeRequestCountUpdater.get(this) == 0) {
if (listenerUpdater.compareAndSet(this, requestCountListener, null)) {
requestCountListener.done();
}
}
} | [
"public",
"void",
"pause",
"(",
"ServerActivityCallback",
"requestCountListener",
")",
"{",
"if",
"(",
"paused",
")",
"{",
"throw",
"ServerLogger",
".",
"ROOT_LOGGER",
".",
"serverAlreadyPaused",
"(",
")",
";",
"}",
"this",
".",
"paused",
"=",
"true",
";",
"... | Pause the current entry point, and invoke the provided listener when all current requests have finished.
If individual control point tracking is not enabled then the listener will be invoked straight away
@param requestCountListener The listener to invoke | [
"Pause",
"the",
"current",
"entry",
"point",
"and",
"invoke",
"the",
"provided",
"listener",
"when",
"all",
"current",
"requests",
"have",
"finished",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java#L95-L106 | train |
wildfly/wildfly-core | request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java | ControlPoint.resume | public void resume() {
this.paused = false;
ServerActivityCallback listener = listenerUpdater.get(this);
if (listener != null) {
listenerUpdater.compareAndSet(this, listener, null);
}
} | java | public void resume() {
this.paused = false;
ServerActivityCallback listener = listenerUpdater.get(this);
if (listener != null) {
listenerUpdater.compareAndSet(this, listener, null);
}
} | [
"public",
"void",
"resume",
"(",
")",
"{",
"this",
".",
"paused",
"=",
"false",
";",
"ServerActivityCallback",
"listener",
"=",
"listenerUpdater",
".",
"get",
"(",
"this",
")",
";",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"listenerUpdater",
".",
"... | Cancel the pause operation | [
"Cancel",
"the",
"pause",
"operation"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/ControlPoint.java#L111-L117 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/mgmt/HostInfo.java | HostInfo.createLocalHostHostInfo | public static ModelNode createLocalHostHostInfo(final LocalHostControllerInfo hostInfo, final ProductConfig productConfig,
final IgnoredDomainResourceRegistry ignoredResourceRegistry, final Resource hostModelResource) {
final ModelNode info = new ModelNode();
info.get(NAME).set(hostInfo.getLocalHostName());
info.get(RELEASE_VERSION).set(Version.AS_VERSION);
info.get(RELEASE_CODENAME).set(Version.AS_RELEASE_CODENAME);
info.get(MANAGEMENT_MAJOR_VERSION).set(Version.MANAGEMENT_MAJOR_VERSION);
info.get(MANAGEMENT_MINOR_VERSION).set(Version.MANAGEMENT_MINOR_VERSION);
info.get(MANAGEMENT_MICRO_VERSION).set(Version.MANAGEMENT_MICRO_VERSION);
final String productName = productConfig.getProductName();
final String productVersion = productConfig.getProductVersion();
if(productName != null) {
info.get(PRODUCT_NAME).set(productName);
}
if(productVersion != null) {
info.get(PRODUCT_VERSION).set(productVersion);
}
ModelNode ignoredModel = ignoredResourceRegistry.getIgnoredResourcesAsModel();
if (ignoredModel.hasDefined(IGNORED_RESOURCE_TYPE)) {
info.get(IGNORED_RESOURCES).set(ignoredModel.require(IGNORED_RESOURCE_TYPE));
}
boolean ignoreUnaffectedServerGroups = hostInfo.isRemoteDomainControllerIgnoreUnaffectedConfiguration();
IgnoredNonAffectedServerGroupsUtil.addCurrentServerGroupsToHostInfoModel(ignoreUnaffectedServerGroups, hostModelResource, info);
return info;
} | java | public static ModelNode createLocalHostHostInfo(final LocalHostControllerInfo hostInfo, final ProductConfig productConfig,
final IgnoredDomainResourceRegistry ignoredResourceRegistry, final Resource hostModelResource) {
final ModelNode info = new ModelNode();
info.get(NAME).set(hostInfo.getLocalHostName());
info.get(RELEASE_VERSION).set(Version.AS_VERSION);
info.get(RELEASE_CODENAME).set(Version.AS_RELEASE_CODENAME);
info.get(MANAGEMENT_MAJOR_VERSION).set(Version.MANAGEMENT_MAJOR_VERSION);
info.get(MANAGEMENT_MINOR_VERSION).set(Version.MANAGEMENT_MINOR_VERSION);
info.get(MANAGEMENT_MICRO_VERSION).set(Version.MANAGEMENT_MICRO_VERSION);
final String productName = productConfig.getProductName();
final String productVersion = productConfig.getProductVersion();
if(productName != null) {
info.get(PRODUCT_NAME).set(productName);
}
if(productVersion != null) {
info.get(PRODUCT_VERSION).set(productVersion);
}
ModelNode ignoredModel = ignoredResourceRegistry.getIgnoredResourcesAsModel();
if (ignoredModel.hasDefined(IGNORED_RESOURCE_TYPE)) {
info.get(IGNORED_RESOURCES).set(ignoredModel.require(IGNORED_RESOURCE_TYPE));
}
boolean ignoreUnaffectedServerGroups = hostInfo.isRemoteDomainControllerIgnoreUnaffectedConfiguration();
IgnoredNonAffectedServerGroupsUtil.addCurrentServerGroupsToHostInfoModel(ignoreUnaffectedServerGroups, hostModelResource, info);
return info;
} | [
"public",
"static",
"ModelNode",
"createLocalHostHostInfo",
"(",
"final",
"LocalHostControllerInfo",
"hostInfo",
",",
"final",
"ProductConfig",
"productConfig",
",",
"final",
"IgnoredDomainResourceRegistry",
"ignoredResourceRegistry",
",",
"final",
"Resource",
"hostModelResourc... | Create the metadata which gets send to the DC when registering.
@param hostInfo the local host info
@param productConfig the product config
@param ignoredResourceRegistry registry of ignored resources
@return the host info | [
"Create",
"the",
"metadata",
"which",
"gets",
"send",
"to",
"the",
"DC",
"when",
"registering",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/mgmt/HostInfo.java#L85-L109 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/Environment.java | Environment.addModuleDir | public void addModuleDir(final String moduleDir) {
if (moduleDir == null) {
throw LauncherMessages.MESSAGES.nullParam("moduleDir");
}
// Validate the path
final Path path = Paths.get(moduleDir).normalize();
modulesDirs.add(path.toString());
} | java | public void addModuleDir(final String moduleDir) {
if (moduleDir == null) {
throw LauncherMessages.MESSAGES.nullParam("moduleDir");
}
// Validate the path
final Path path = Paths.get(moduleDir).normalize();
modulesDirs.add(path.toString());
} | [
"public",
"void",
"addModuleDir",
"(",
"final",
"String",
"moduleDir",
")",
"{",
"if",
"(",
"moduleDir",
"==",
"null",
")",
"{",
"throw",
"LauncherMessages",
".",
"MESSAGES",
".",
"nullParam",
"(",
"\"moduleDir\"",
")",
";",
"}",
"// Validate the path",
"final... | Adds a directory to the collection of module paths.
@param moduleDir the module directory to add
@throws java.lang.IllegalArgumentException if the path is {@code null} | [
"Adds",
"a",
"directory",
"to",
"the",
"collection",
"of",
"module",
"paths",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Environment.java#L93-L100 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/Environment.java | Environment.getModulePaths | public String getModulePaths() {
final StringBuilder result = new StringBuilder();
if (addDefaultModuleDir) {
result.append(wildflyHome.resolve("modules").toString());
}
if (!modulesDirs.isEmpty()) {
if (addDefaultModuleDir) result.append(File.pathSeparator);
for (Iterator<String> iterator = modulesDirs.iterator(); iterator.hasNext(); ) {
result.append(iterator.next());
if (iterator.hasNext()) {
result.append(File.pathSeparator);
}
}
}
return result.toString();
} | java | public String getModulePaths() {
final StringBuilder result = new StringBuilder();
if (addDefaultModuleDir) {
result.append(wildflyHome.resolve("modules").toString());
}
if (!modulesDirs.isEmpty()) {
if (addDefaultModuleDir) result.append(File.pathSeparator);
for (Iterator<String> iterator = modulesDirs.iterator(); iterator.hasNext(); ) {
result.append(iterator.next());
if (iterator.hasNext()) {
result.append(File.pathSeparator);
}
}
}
return result.toString();
} | [
"public",
"String",
"getModulePaths",
"(",
")",
"{",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"addDefaultModuleDir",
")",
"{",
"result",
".",
"append",
"(",
"wildflyHome",
".",
"resolve",
"(",
"\"modules\"",
... | Returns the modules paths used on the command line.
@return the paths separated by the {@link File#pathSeparator path separator} | [
"Returns",
"the",
"modules",
"paths",
"used",
"on",
"the",
"command",
"line",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Environment.java#L171-L186 | train |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java | ExistingChannelModelControllerClient.createAndAdd | public static ModelControllerClient createAndAdd(final ManagementChannelHandler handler) {
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
return client;
} | java | public static ModelControllerClient createAndAdd(final ManagementChannelHandler handler) {
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
return client;
} | [
"public",
"static",
"ModelControllerClient",
"createAndAdd",
"(",
"final",
"ManagementChannelHandler",
"handler",
")",
"{",
"final",
"ExistingChannelModelControllerClient",
"client",
"=",
"new",
"ExistingChannelModelControllerClient",
"(",
"handler",
")",
";",
"handler",
".... | Create and add model controller handler to an existing management channel handler.
@param handler the channel handler
@return the created client | [
"Create",
"and",
"add",
"model",
"controller",
"handler",
"to",
"an",
"existing",
"management",
"channel",
"handler",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java#L63-L67 | train |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java | ExistingChannelModelControllerClient.createReceiving | public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService);
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdown();
try {
handler.awaitCompletion(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
handler.shutdownNow();
}
}
});
channel.receiveMessage(handler.getReceiver());
return client;
} | java | public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) {
final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel);
final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorService);
final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler);
handler.addHandlerFactory(client);
channel.addCloseHandler(new CloseHandler<Channel>() {
@Override
public void handleClose(Channel closed, IOException exception) {
handler.shutdown();
try {
handler.awaitCompletion(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
handler.shutdownNow();
}
}
});
channel.receiveMessage(handler.getReceiver());
return client;
} | [
"public",
"static",
"ModelControllerClient",
"createReceiving",
"(",
"final",
"Channel",
"channel",
",",
"final",
"ExecutorService",
"executorService",
")",
"{",
"final",
"ManagementClientChannelStrategy",
"strategy",
"=",
"ManagementClientChannelStrategy",
".",
"create",
"... | Create a model controller client which is exclusively receiving messages on an existing channel.
@param channel the channel
@param executorService an executor
@return the created client | [
"Create",
"a",
"model",
"controller",
"client",
"which",
"is",
"exclusively",
"receiving",
"messages",
"on",
"an",
"existing",
"channel",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/impl/ExistingChannelModelControllerClient.java#L76-L96 | train |
wildfly/wildfly-core | domain-management/src/main/java/org/jboss/as/domain/management/security/UserPropertiesFileLoader.java | UserPropertiesFileLoader.addLineContent | @Override
protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException {
// Is the line an empty comment "#" ?
if (line.startsWith(COMMENT_PREFIX) && line.length() == 1) {
String nextLine = bufferedFileReader.readLine();
if (nextLine != null) {
// Is the next line the realm name "#$REALM_NAME=" ?
if (nextLine.startsWith(COMMENT_PREFIX) && nextLine.contains(REALM_COMMENT_PREFIX)) {
// Realm name block detected!
// The next line must be and empty comment "#"
bufferedFileReader.readLine();
// Avoid adding the realm block
} else {
// It's a user comment...
content.add(line);
content.add(nextLine);
}
} else {
super.addLineContent(bufferedFileReader, content, line);
}
} else {
super.addLineContent(bufferedFileReader, content, line);
}
} | java | @Override
protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException {
// Is the line an empty comment "#" ?
if (line.startsWith(COMMENT_PREFIX) && line.length() == 1) {
String nextLine = bufferedFileReader.readLine();
if (nextLine != null) {
// Is the next line the realm name "#$REALM_NAME=" ?
if (nextLine.startsWith(COMMENT_PREFIX) && nextLine.contains(REALM_COMMENT_PREFIX)) {
// Realm name block detected!
// The next line must be and empty comment "#"
bufferedFileReader.readLine();
// Avoid adding the realm block
} else {
// It's a user comment...
content.add(line);
content.add(nextLine);
}
} else {
super.addLineContent(bufferedFileReader, content, line);
}
} else {
super.addLineContent(bufferedFileReader, content, line);
}
} | [
"@",
"Override",
"protected",
"void",
"addLineContent",
"(",
"BufferedReader",
"bufferedFileReader",
",",
"List",
"<",
"String",
">",
"content",
",",
"String",
"line",
")",
"throws",
"IOException",
"{",
"// Is the line an empty comment \"#\" ?",
"if",
"(",
"line",
"... | Remove the realm name block.
@see PropertiesFileLoader#addLineContent(java.io.BufferedReader, java.util.List, String) | [
"Remove",
"the",
"realm",
"name",
"block",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/UserPropertiesFileLoader.java#L170-L193 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/OperationDefinition.java | OperationDefinition.validateOperation | @Deprecated
public void validateOperation(final ModelNode operation) throws OperationFailedException {
if (operation.hasDefined(ModelDescriptionConstants.OPERATION_NAME) && deprecationData != null && deprecationData.isNotificationUseful()) {
ControllerLogger.DEPRECATED_LOGGER.operationDeprecated(getName(),
PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString());
}
for (AttributeDefinition ad : this.parameters) {
ad.validateOperation(operation);
}
} | java | @Deprecated
public void validateOperation(final ModelNode operation) throws OperationFailedException {
if (operation.hasDefined(ModelDescriptionConstants.OPERATION_NAME) && deprecationData != null && deprecationData.isNotificationUseful()) {
ControllerLogger.DEPRECATED_LOGGER.operationDeprecated(getName(),
PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).toCLIStyleString());
}
for (AttributeDefinition ad : this.parameters) {
ad.validateOperation(operation);
}
} | [
"@",
"Deprecated",
"public",
"void",
"validateOperation",
"(",
"final",
"ModelNode",
"operation",
")",
"throws",
"OperationFailedException",
"{",
"if",
"(",
"operation",
".",
"hasDefined",
"(",
"ModelDescriptionConstants",
".",
"OPERATION_NAME",
")",
"&&",
"deprecatio... | Validates operation model against the definition and its parameters
@param operation model node of type {@link ModelType#OBJECT}, representing an operation request
@throws OperationFailedException if the value is not valid
@deprecated Not used by the WildFly management kernel; will be removed in a future release | [
"Validates",
"operation",
"model",
"against",
"the",
"definition",
"and",
"its",
"parameters"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/OperationDefinition.java#L172-L181 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/OperationDefinition.java | OperationDefinition.validateAndSet | @SuppressWarnings("deprecation")
@Deprecated
public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException {
validateOperation(operationObject);
for (AttributeDefinition ad : this.parameters) {
ad.validateAndSet(operationObject, model);
}
} | java | @SuppressWarnings("deprecation")
@Deprecated
public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException {
validateOperation(operationObject);
for (AttributeDefinition ad : this.parameters) {
ad.validateAndSet(operationObject, model);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"@",
"Deprecated",
"public",
"final",
"void",
"validateAndSet",
"(",
"ModelNode",
"operationObject",
",",
"final",
"ModelNode",
"model",
")",
"throws",
"OperationFailedException",
"{",
"validateOperation",
"(",
"op... | validates operation against the definition and sets model for the parameters passed.
@param operationObject model node of type {@link ModelType#OBJECT}, typically representing an operation request
@param model model node in which the value should be stored
@throws OperationFailedException if the value is not valid
@deprecated Not used by the WildFly management kernel; will be removed in a future release | [
"validates",
"operation",
"against",
"the",
"definition",
"and",
"sets",
"model",
"for",
"the",
"parameters",
"passed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/OperationDefinition.java#L192-L199 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/validation/BasicArtifactProcessor.java | BasicArtifactProcessor.getHandlerForArtifact | <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> PatchingArtifactStateHandler<S> getHandlerForArtifact(PatchingArtifact<P, S> artifact) {
return handlers.get(artifact);
} | java | <P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> PatchingArtifactStateHandler<S> getHandlerForArtifact(PatchingArtifact<P, S> artifact) {
return handlers.get(artifact);
} | [
"<",
"P",
"extends",
"PatchingArtifact",
".",
"ArtifactState",
",",
"S",
"extends",
"PatchingArtifact",
".",
"ArtifactState",
">",
"PatchingArtifactStateHandler",
"<",
"S",
">",
"getHandlerForArtifact",
"(",
"PatchingArtifact",
"<",
"P",
",",
"S",
">",
"artifact",
... | Get a state handler for a given patching artifact.
@param artifact the patching artifact
@param <P>
@param <S>
@return the state handler, {@code null} if there is no handler registered for the given artifact | [
"Get",
"a",
"state",
"handler",
"for",
"a",
"given",
"patching",
"artifact",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/BasicArtifactProcessor.java#L123-L125 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java | CapabilityResolutionContext.getAttachment | public <V> V getAttachment(final AttachmentKey<V> key) {
assert key != null;
return key.cast(contextAttachments.get(key));
} | java | public <V> V getAttachment(final AttachmentKey<V> key) {
assert key != null;
return key.cast(contextAttachments.get(key));
} | [
"public",
"<",
"V",
">",
"V",
"getAttachment",
"(",
"final",
"AttachmentKey",
"<",
"V",
">",
"key",
")",
"{",
"assert",
"key",
"!=",
"null",
";",
"return",
"key",
".",
"cast",
"(",
"contextAttachments",
".",
"get",
"(",
"key",
")",
")",
";",
"}"
] | Retrieves an object that has been attached to this context.
@param key the key to the attachment.
@param <V> the value type of the attachment.
@return the attachment if found otherwise {@code null}. | [
"Retrieves",
"an",
"object",
"that",
"has",
"been",
"attached",
"to",
"this",
"context",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L54-L57 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java | CapabilityResolutionContext.attach | public <V> V attach(final AttachmentKey<V> key, final V value) {
assert key != null;
return key.cast(contextAttachments.put(key, value));
} | java | public <V> V attach(final AttachmentKey<V> key, final V value) {
assert key != null;
return key.cast(contextAttachments.put(key, value));
} | [
"public",
"<",
"V",
">",
"V",
"attach",
"(",
"final",
"AttachmentKey",
"<",
"V",
">",
"key",
",",
"final",
"V",
"value",
")",
"{",
"assert",
"key",
"!=",
"null",
";",
"return",
"key",
".",
"cast",
"(",
"contextAttachments",
".",
"put",
"(",
"key",
... | Attaches an arbitrary object to this context.
@param key they attachment key used to ensure uniqueness and used for retrieval of the value.
@param value the value to store.
@param <V> the value type of the attachment.
@return the previous value associated with the key or {@code null} if there was no previous value. | [
"Attaches",
"an",
"arbitrary",
"object",
"to",
"this",
"context",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L68-L71 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java | CapabilityResolutionContext.attachIfAbsent | public <V> V attachIfAbsent(final AttachmentKey<V> key, final V value) {
assert key != null;
return key.cast(contextAttachments.putIfAbsent(key, value));
} | java | public <V> V attachIfAbsent(final AttachmentKey<V> key, final V value) {
assert key != null;
return key.cast(contextAttachments.putIfAbsent(key, value));
} | [
"public",
"<",
"V",
">",
"V",
"attachIfAbsent",
"(",
"final",
"AttachmentKey",
"<",
"V",
">",
"key",
",",
"final",
"V",
"value",
")",
"{",
"assert",
"key",
"!=",
"null",
";",
"return",
"key",
".",
"cast",
"(",
"contextAttachments",
".",
"putIfAbsent",
... | Attaches an arbitrary object to this context only if the object was not already attached. If a value has already
been attached with the key provided, the current value associated with the key is returned.
@param key they attachment key used to ensure uniqueness and used for retrieval of the value.
@param value the value to store.
@param <V> the value type of the attachment.
@return the previous value associated with the key or {@code null} if there was no previous value. | [
"Attaches",
"an",
"arbitrary",
"object",
"to",
"this",
"context",
"only",
"if",
"the",
"object",
"was",
"not",
"already",
"attached",
".",
"If",
"a",
"value",
"has",
"already",
"been",
"attached",
"with",
"the",
"key",
"provided",
"the",
"current",
"value",
... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L83-L86 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java | CapabilityResolutionContext.detach | public <V> V detach(final AttachmentKey<V> key) {
assert key != null;
return key.cast(contextAttachments.remove(key));
} | java | public <V> V detach(final AttachmentKey<V> key) {
assert key != null;
return key.cast(contextAttachments.remove(key));
} | [
"public",
"<",
"V",
">",
"V",
"detach",
"(",
"final",
"AttachmentKey",
"<",
"V",
">",
"key",
")",
"{",
"assert",
"key",
"!=",
"null",
";",
"return",
"key",
".",
"cast",
"(",
"contextAttachments",
".",
"remove",
"(",
"key",
")",
")",
";",
"}"
] | Detaches or removes the value from this context.
@param key the key to the attachment.
@param <V> the value type of the attachment.
@return the attachment if found otherwise {@code null}. | [
"Detaches",
"or",
"removes",
"the",
"value",
"from",
"this",
"context",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/registry/CapabilityResolutionContext.java#L96-L99 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/parsing/InterfacesXml.java | InterfacesXml.writeInterfaceCriteria | private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException {
for (final Property property : subModel.asPropertyList()) {
if (property.getValue().isDefined()) {
writeInterfaceCriteria(writer, property, nested);
}
}
} | java | private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException {
for (final Property property : subModel.asPropertyList()) {
if (property.getValue().isDefined()) {
writeInterfaceCriteria(writer, property, nested);
}
}
} | [
"private",
"void",
"writeInterfaceCriteria",
"(",
"final",
"XMLExtendedStreamWriter",
"writer",
",",
"final",
"ModelNode",
"subModel",
",",
"final",
"boolean",
"nested",
")",
"throws",
"XMLStreamException",
"{",
"for",
"(",
"final",
"Property",
"property",
":",
"sub... | Write the criteria elements, extracting the information of the sub-model.
@param writer the xml stream writer
@param subModel the interface model
@param nested whether it the criteria elements are nested as part of <not /> or <any />
@throws XMLStreamException | [
"Write",
"the",
"criteria",
"elements",
"extracting",
"the",
"information",
"of",
"the",
"sub",
"-",
"model",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/parsing/InterfacesXml.java#L280-L286 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java | ConfigurationPersisterFactory.createHostXmlConfigurationPersister | public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment,
final ExecutorService executorService, final ExtensionRegistry hostExtensionRegistry,
final LocalHostControllerInfo localHostControllerInfo) {
String defaultHostname = localHostControllerInfo.getLocalHostName();
if (environment.getRunningModeControl().isReloaded()) {
if (environment.getRunningModeControl().getReloadHostName() != null) {
defaultHostname = environment.getRunningModeControl().getReloadHostName();
}
}
HostXml hostXml = new HostXml(defaultHostname, environment.getRunningModeControl().getRunningMode(),
environment.isUseCachedDc(), Module.getBootModuleLoader(), executorService, hostExtensionRegistry);
BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "host"), hostXml, hostXml, false);
for (Namespace namespace : Namespace.domainValues()) {
if (!namespace.equals(Namespace.CURRENT)) {
persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "host"), hostXml);
}
}
hostExtensionRegistry.setWriterRegistry(persister);
return persister;
} | java | public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment,
final ExecutorService executorService, final ExtensionRegistry hostExtensionRegistry,
final LocalHostControllerInfo localHostControllerInfo) {
String defaultHostname = localHostControllerInfo.getLocalHostName();
if (environment.getRunningModeControl().isReloaded()) {
if (environment.getRunningModeControl().getReloadHostName() != null) {
defaultHostname = environment.getRunningModeControl().getReloadHostName();
}
}
HostXml hostXml = new HostXml(defaultHostname, environment.getRunningModeControl().getRunningMode(),
environment.isUseCachedDc(), Module.getBootModuleLoader(), executorService, hostExtensionRegistry);
BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "host"), hostXml, hostXml, false);
for (Namespace namespace : Namespace.domainValues()) {
if (!namespace.equals(Namespace.CURRENT)) {
persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "host"), hostXml);
}
}
hostExtensionRegistry.setWriterRegistry(persister);
return persister;
} | [
"public",
"static",
"ExtensibleConfigurationPersister",
"createHostXmlConfigurationPersister",
"(",
"final",
"ConfigurationFile",
"file",
",",
"final",
"HostControllerEnvironment",
"environment",
",",
"final",
"ExecutorService",
"executorService",
",",
"final",
"ExtensionRegistry... | host.xml | [
"host",
".",
"xml"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java#L67-L86 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java | ConfigurationPersisterFactory.createDomainXmlConfigurationPersister | public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister(final ConfigurationFile file, ExecutorService executorService, ExtensionRegistry extensionRegistry, final HostControllerEnvironment environment) {
DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
boolean suppressLoad = false;
ConfigurationFile.InteractionPolicy policy = file.getInteractionPolicy();
final boolean isReloaded = environment.getRunningModeControl().isReloaded();
if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW && (file.getBootFile().exists() && file.getBootFile().length() != 0))) {
throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteDomainXmlWithEmpty(file.getBootFile().getName());
}
if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD)) {
suppressLoad = true;
}
BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "domain"), domainXml, domainXml, suppressLoad);
for (Namespace namespace : Namespace.domainValues()) {
if (!namespace.equals(Namespace.CURRENT)) {
persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "domain"), domainXml);
}
}
extensionRegistry.setWriterRegistry(persister);
return persister;
} | java | public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister(final ConfigurationFile file, ExecutorService executorService, ExtensionRegistry extensionRegistry, final HostControllerEnvironment environment) {
DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
boolean suppressLoad = false;
ConfigurationFile.InteractionPolicy policy = file.getInteractionPolicy();
final boolean isReloaded = environment.getRunningModeControl().isReloaded();
if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW && (file.getBootFile().exists() && file.getBootFile().length() != 0))) {
throw HostControllerLogger.ROOT_LOGGER.cannotOverwriteDomainXmlWithEmpty(file.getBootFile().getName());
}
if (!isReloaded && (policy == ConfigurationFile.InteractionPolicy.NEW || policy == ConfigurationFile.InteractionPolicy.DISCARD)) {
suppressLoad = true;
}
BackupXmlConfigurationPersister persister = new BackupXmlConfigurationPersister(file, new QName(Namespace.CURRENT.getUriString(), "domain"), domainXml, domainXml, suppressLoad);
for (Namespace namespace : Namespace.domainValues()) {
if (!namespace.equals(Namespace.CURRENT)) {
persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "domain"), domainXml);
}
}
extensionRegistry.setWriterRegistry(persister);
return persister;
} | [
"public",
"static",
"ExtensibleConfigurationPersister",
"createDomainXmlConfigurationPersister",
"(",
"final",
"ConfigurationFile",
"file",
",",
"ExecutorService",
"executorService",
",",
"ExtensionRegistry",
"extensionRegistry",
",",
"final",
"HostControllerEnvironment",
"environm... | domain.xml | [
"domain",
".",
"xml"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java#L89-L112 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java | ConfigurationPersisterFactory.createTransientDomainXmlConfigurationPersister | public static ExtensibleConfigurationPersister createTransientDomainXmlConfigurationPersister(ExecutorService executorService, ExtensionRegistry extensionRegistry) {
DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
ExtensibleConfigurationPersister persister = new NullConfigurationPersister(domainXml);
extensionRegistry.setWriterRegistry(persister);
return persister;
} | java | public static ExtensibleConfigurationPersister createTransientDomainXmlConfigurationPersister(ExecutorService executorService, ExtensionRegistry extensionRegistry) {
DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
ExtensibleConfigurationPersister persister = new NullConfigurationPersister(domainXml);
extensionRegistry.setWriterRegistry(persister);
return persister;
} | [
"public",
"static",
"ExtensibleConfigurationPersister",
"createTransientDomainXmlConfigurationPersister",
"(",
"ExecutorService",
"executorService",
",",
"ExtensionRegistry",
"extensionRegistry",
")",
"{",
"DomainXml",
"domainXml",
"=",
"new",
"DomainXml",
"(",
"Module",
".",
... | slave=true | [
"slave",
"=",
"true"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ConfigurationPersisterFactory.java#L135-L140 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchingTasks.java | PatchingTasks.apply | static void apply(final String patchId, final Collection<ContentModification> modifications, final PatchEntry patchEntry, final ContentItemFilter filter) {
for (final ContentModification modification : modifications) {
final ContentItem item = modification.getItem();
// Check if we accept the item
if (!filter.accepts(item)) {
continue;
}
final Location location = new Location(item);
final ContentEntry contentEntry = new ContentEntry(patchId, modification);
ContentTaskDefinition definition = patchEntry.get(location);
if (definition == null) {
definition = new ContentTaskDefinition(location, contentEntry, false);
patchEntry.put(location, definition);
} else {
definition.setTarget(contentEntry);
}
}
} | java | static void apply(final String patchId, final Collection<ContentModification> modifications, final PatchEntry patchEntry, final ContentItemFilter filter) {
for (final ContentModification modification : modifications) {
final ContentItem item = modification.getItem();
// Check if we accept the item
if (!filter.accepts(item)) {
continue;
}
final Location location = new Location(item);
final ContentEntry contentEntry = new ContentEntry(patchId, modification);
ContentTaskDefinition definition = patchEntry.get(location);
if (definition == null) {
definition = new ContentTaskDefinition(location, contentEntry, false);
patchEntry.put(location, definition);
} else {
definition.setTarget(contentEntry);
}
}
} | [
"static",
"void",
"apply",
"(",
"final",
"String",
"patchId",
",",
"final",
"Collection",
"<",
"ContentModification",
">",
"modifications",
",",
"final",
"PatchEntry",
"patchEntry",
",",
"final",
"ContentItemFilter",
"filter",
")",
"{",
"for",
"(",
"final",
"Con... | Apply modifications to a content task definition.
@param patchId the patch id
@param modifications the modifications
@param definitions the task definitions
@param filter the content item filter | [
"Apply",
"modifications",
"to",
"a",
"content",
"task",
"definition",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchingTasks.java#L165-L184 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java | ServiceRemoveStepHandler.serviceName | protected ServiceName serviceName(final String name) {
return baseServiceName != null ? baseServiceName.append(name) : null;
} | java | protected ServiceName serviceName(final String name) {
return baseServiceName != null ? baseServiceName.append(name) : null;
} | [
"protected",
"ServiceName",
"serviceName",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"baseServiceName",
"!=",
"null",
"?",
"baseServiceName",
".",
"append",
"(",
"name",
")",
":",
"null",
";",
"}"
] | The service name to be removed. Can be overridden for unusual service naming patterns
@param name The name of the resource being removed
@return The service name to remove. May return {@code null} if only removal based on {@code unavailableCapabilities}
passed to the constructor are to be performed | [
"The",
"service",
"name",
"to",
"be",
"removed",
".",
"Can",
"be",
"overridden",
"for",
"unusual",
"service",
"naming",
"patterns"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java#L152-L154 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java | ModuleNameTabCompleter.subModuleExists | private boolean subModuleExists(File dir) {
if (isSlotDirectory(dir)) {
return true;
} else {
File[] children = dir.listFiles(File::isDirectory);
for (File child : children) {
if (subModuleExists(child)) {
return true;
}
}
}
return false;
} | java | private boolean subModuleExists(File dir) {
if (isSlotDirectory(dir)) {
return true;
} else {
File[] children = dir.listFiles(File::isDirectory);
for (File child : children) {
if (subModuleExists(child)) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"subModuleExists",
"(",
"File",
"dir",
")",
"{",
"if",
"(",
"isSlotDirectory",
"(",
"dir",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"File",
"[",
"]",
"children",
"=",
"dir",
".",
"listFiles",
"(",
"File",
"::",
"i... | depth- first search for any module - just to check that the suggestion has any chance of delivering correct result | [
"depth",
"-",
"first",
"search",
"for",
"any",
"module",
"-",
"just",
"to",
"check",
"that",
"the",
"suggestion",
"has",
"any",
"chance",
"of",
"delivering",
"correct",
"result"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java#L169-L182 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java | ModuleNameTabCompleter.tail | private String tail(String moduleName) {
if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) {
return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1);
} else {
return "";
}
} | java | private String tail(String moduleName) {
if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) {
return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1);
} else {
return "";
}
} | [
"private",
"String",
"tail",
"(",
"String",
"moduleName",
")",
"{",
"if",
"(",
"moduleName",
".",
"indexOf",
"(",
"MODULE_NAME_SEPARATOR",
")",
">",
"0",
")",
"{",
"return",
"moduleName",
".",
"substring",
"(",
"moduleName",
".",
"indexOf",
"(",
"MODULE_NAME... | get all parts of module name apart from first | [
"get",
"all",
"parts",
"of",
"module",
"name",
"apart",
"from",
"first"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java#L210-L216 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerClient.java | HostControllerClient.resolveBootUpdates | void resolveBootUpdates(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception {
connection.openConnection(controller, callback);
// Keep a reference to the the controller
this.controller = controller;
} | java | void resolveBootUpdates(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception {
connection.openConnection(controller, callback);
// Keep a reference to the the controller
this.controller = controller;
} | [
"void",
"resolveBootUpdates",
"(",
"final",
"ModelController",
"controller",
",",
"final",
"ActiveOperation",
".",
"CompletedCallback",
"<",
"ModelNode",
">",
"callback",
")",
"throws",
"Exception",
"{",
"connection",
".",
"openConnection",
"(",
"controller",
",",
"... | Resolve the boot updates and register at the local HC.
@param controller the model controller
@param callback the completed callback
@throws Exception for any error | [
"Resolve",
"the",
"boot",
"updates",
"and",
"register",
"at",
"the",
"local",
"HC",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerClient.java#L111-L115 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java | VaultConfig.loadExternalFile | static VaultConfig loadExternalFile(File f) throws XMLStreamException {
if(f == null) {
throw new IllegalArgumentException("File is null");
}
if(!f.exists()) {
throw new XMLStreamException("Failed to locate vault file " + f.getAbsolutePath());
}
final VaultConfig config = new VaultConfig();
BufferedInputStream input = null;
try {
final XMLMapper mapper = XMLMapper.Factory.create();
final XMLElementReader<VaultConfig> reader = new ExternalVaultConfigReader();
mapper.registerRootElement(new QName(VAULT), reader);
FileInputStream is = new FileInputStream(f);
input = new BufferedInputStream(is);
XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(input);
mapper.parseDocument(config, streamReader);
streamReader.close();
} catch(FileNotFoundException e) {
throw new XMLStreamException("Vault file not found", e);
} catch(XMLStreamException t) {
throw t;
} finally {
StreamUtils.safeClose(input);
}
return config;
} | java | static VaultConfig loadExternalFile(File f) throws XMLStreamException {
if(f == null) {
throw new IllegalArgumentException("File is null");
}
if(!f.exists()) {
throw new XMLStreamException("Failed to locate vault file " + f.getAbsolutePath());
}
final VaultConfig config = new VaultConfig();
BufferedInputStream input = null;
try {
final XMLMapper mapper = XMLMapper.Factory.create();
final XMLElementReader<VaultConfig> reader = new ExternalVaultConfigReader();
mapper.registerRootElement(new QName(VAULT), reader);
FileInputStream is = new FileInputStream(f);
input = new BufferedInputStream(is);
XMLStreamReader streamReader = XMLInputFactory.newInstance().createXMLStreamReader(input);
mapper.parseDocument(config, streamReader);
streamReader.close();
} catch(FileNotFoundException e) {
throw new XMLStreamException("Vault file not found", e);
} catch(XMLStreamException t) {
throw t;
} finally {
StreamUtils.safeClose(input);
}
return config;
} | [
"static",
"VaultConfig",
"loadExternalFile",
"(",
"File",
"f",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"f",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"File is null\"",
")",
";",
"}",
"if",
"(",
"!",
"f",
".",
"... | In the 2.0 xsd the vault is in an external file, which has no namespace, using the output of the vault tool.
@param f the file containing the external vault configuration as generated by the vault tool
@return the vault config | [
"In",
"the",
"2",
".",
"0",
"xsd",
"the",
"vault",
"is",
"in",
"an",
"external",
"file",
"which",
"has",
"no",
"namespace",
"using",
"the",
"output",
"of",
"the",
"vault",
"tool",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java#L68-L95 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java | VaultConfig.readVaultElement_3_0 | static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException {
final VaultConfig config = new VaultConfig();
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
String name = reader.getAttributeLocalName(i);
if (name.equals(CODE)){
config.code = value;
} else if (name.equals(MODULE)){
config.module = value;
} else {
unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader);
}
}
if (config.code == null && config.module != null){
throw new XMLStreamException("Attribute 'module' was specified without an attribute"
+ " 'code' for element '" + VAULT + "' at " + reader.getLocation());
}
readVaultOptions(reader, config);
return config;
} | java | static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException {
final VaultConfig config = new VaultConfig();
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
String name = reader.getAttributeLocalName(i);
if (name.equals(CODE)){
config.code = value;
} else if (name.equals(MODULE)){
config.module = value;
} else {
unexpectedVaultAttribute(reader.getAttributeLocalName(i), reader);
}
}
if (config.code == null && config.module != null){
throw new XMLStreamException("Attribute 'module' was specified without an attribute"
+ " 'code' for element '" + VAULT + "' at " + reader.getLocation());
}
readVaultOptions(reader, config);
return config;
} | [
"static",
"VaultConfig",
"readVaultElement_3_0",
"(",
"XMLExtendedStreamReader",
"reader",
",",
"Namespace",
"expectedNs",
")",
"throws",
"XMLStreamException",
"{",
"final",
"VaultConfig",
"config",
"=",
"new",
"VaultConfig",
"(",
")",
";",
"final",
"int",
"count",
... | In the 3.0 xsd the vault configuration and its options are part of the vault xsd.
@param reader the reader at the vault element
@param expectedNs the namespace
@return the vault configuration | [
"In",
"the",
"3",
".",
"0",
"xsd",
"the",
"vault",
"configuration",
"and",
"its",
"options",
"are",
"part",
"of",
"the",
"vault",
"xsd",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/VaultConfig.java#L104-L125 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.