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 | controller/src/main/java/org/jboss/as/controller/transform/RejectExpressionValuesTransformer.java | RejectExpressionValuesTransformer.checkModel | private Set<String> checkModel(final ModelNode model, TransformationContext context) throws OperationFailedException {
final Set<String> attributes = new HashSet<String>();
AttributeTransformationRequirementChecker checker;
for (final String attribute : attributeNames) {
if (model.hasDefined(attribute)) {
if (attributeCheckers != null && (checker = attributeCheckers.get(attribute)) != null) {
if (checker.isAttributeTransformationRequired(attribute, model.get(attribute), context)) {
attributes.add(attribute);
}
} else if (SIMPLE_EXPRESSIONS.isAttributeTransformationRequired(attribute, model.get(attribute), context)) {
attributes.add(attribute);
}
}
}
return attributes;
} | java | private Set<String> checkModel(final ModelNode model, TransformationContext context) throws OperationFailedException {
final Set<String> attributes = new HashSet<String>();
AttributeTransformationRequirementChecker checker;
for (final String attribute : attributeNames) {
if (model.hasDefined(attribute)) {
if (attributeCheckers != null && (checker = attributeCheckers.get(attribute)) != null) {
if (checker.isAttributeTransformationRequired(attribute, model.get(attribute), context)) {
attributes.add(attribute);
}
} else if (SIMPLE_EXPRESSIONS.isAttributeTransformationRequired(attribute, model.get(attribute), context)) {
attributes.add(attribute);
}
}
}
return attributes;
} | [
"private",
"Set",
"<",
"String",
">",
"checkModel",
"(",
"final",
"ModelNode",
"model",
",",
"TransformationContext",
"context",
")",
"throws",
"OperationFailedException",
"{",
"final",
"Set",
"<",
"String",
">",
"attributes",
"=",
"new",
"HashSet",
"<",
"String... | Check the model for expression values.
@param model the model
@return the attribute containing an expression | [
"Check",
"the",
"model",
"for",
"expression",
"values",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/RejectExpressionValuesTransformer.java#L173-L188 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/OperationDialog.java | OperationDialog.setValue | public void setValue(String propName, Object value) {
for (RequestProp prop : props) {
if (prop.getName().equals(propName)) {
JComponent valComp = prop.getValueComponent();
if (valComp instanceof JTextComponent) {
((JTextComponent)valComp).setText(value.toString());
}
if (valComp instanceof AbstractButton) {
((AbstractButton)valComp).setSelected((Boolean)value);
}
if (valComp instanceof JComboBox) {
((JComboBox)valComp).setSelectedItem(value);
}
return;
}
}
} | java | public void setValue(String propName, Object value) {
for (RequestProp prop : props) {
if (prop.getName().equals(propName)) {
JComponent valComp = prop.getValueComponent();
if (valComp instanceof JTextComponent) {
((JTextComponent)valComp).setText(value.toString());
}
if (valComp instanceof AbstractButton) {
((AbstractButton)valComp).setSelected((Boolean)value);
}
if (valComp instanceof JComboBox) {
((JComboBox)valComp).setSelectedItem(value);
}
return;
}
}
} | [
"public",
"void",
"setValue",
"(",
"String",
"propName",
",",
"Object",
"value",
")",
"{",
"for",
"(",
"RequestProp",
"prop",
":",
"props",
")",
"{",
"if",
"(",
"prop",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"propName",
")",
")",
"{",
"JCompon... | Set the value of the underlying component. Note that this will
not work for ListEditor components. Also, note that for a JComboBox,
The value object must have the same identity as an object in the drop-down.
@param propName The DMR property name to set.
@param value The value. | [
"Set",
"the",
"value",
"of",
"the",
"underlying",
"component",
".",
"Note",
"that",
"this",
"will",
"not",
"work",
"for",
"ListEditor",
"components",
".",
"Also",
"note",
"that",
"for",
"a",
"JComboBox",
"The",
"value",
"object",
"must",
"have",
"the",
"sa... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/OperationDialog.java#L120-L136 | train |
wildfly/wildfly-core | elytron/src/main/java/org/wildfly/extension/elytron/SecurityPropertiesWriteHandler.java | SecurityPropertiesWriteHandler.doDifference | static void doDifference(
Map<String, String> left,
Map<String, String> right,
Map<String, String> onlyOnLeft,
Map<String, String> onlyOnRight,
Map<String, String> updated
) {
onlyOnRight.clear();
onlyOnRight.putAll(right);
for (Map.Entry<String, String> entry : left.entrySet()) {
String leftKey = entry.getKey();
String leftValue = entry.getValue();
if (right.containsKey(leftKey)) {
String rightValue = onlyOnRight.remove(leftKey);
if (!leftValue.equals(rightValue)) {
updated.put(leftKey, leftValue);
}
} else {
onlyOnLeft.put(leftKey, leftValue);
}
}
} | java | static void doDifference(
Map<String, String> left,
Map<String, String> right,
Map<String, String> onlyOnLeft,
Map<String, String> onlyOnRight,
Map<String, String> updated
) {
onlyOnRight.clear();
onlyOnRight.putAll(right);
for (Map.Entry<String, String> entry : left.entrySet()) {
String leftKey = entry.getKey();
String leftValue = entry.getValue();
if (right.containsKey(leftKey)) {
String rightValue = onlyOnRight.remove(leftKey);
if (!leftValue.equals(rightValue)) {
updated.put(leftKey, leftValue);
}
} else {
onlyOnLeft.put(leftKey, leftValue);
}
}
} | [
"static",
"void",
"doDifference",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"left",
",",
"Map",
"<",
"String",
",",
"String",
">",
"right",
",",
"Map",
"<",
"String",
",",
"String",
">",
"onlyOnLeft",
",",
"Map",
"<",
"String",
",",
"String",
">... | calculate the difference of the two maps, so we know what was added, removed & updated
@param left
@param right
@param onlyOnLeft
@param onlyOnRight
@param updated | [
"calculate",
"the",
"difference",
"of",
"the",
"two",
"maps",
"so",
"we",
"know",
"what",
"was",
"added",
"removed",
"&",
"updated"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/SecurityPropertiesWriteHandler.java#L109-L130 | train |
wildfly/wildfly-core | network/src/main/java/org/jboss/as/network/OutboundSocketBinding.java | OutboundSocketBinding.close | public void close() throws IOException {
final ManagedBinding binding = this.socketBindingManager.getNamedRegistry().getManagedBinding(this.name);
if (binding == null) {
return;
}
binding.close();
} | java | public void close() throws IOException {
final ManagedBinding binding = this.socketBindingManager.getNamedRegistry().getManagedBinding(this.name);
if (binding == null) {
return;
}
binding.close();
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"final",
"ManagedBinding",
"binding",
"=",
"this",
".",
"socketBindingManager",
".",
"getNamedRegistry",
"(",
")",
".",
"getManagedBinding",
"(",
"this",
".",
"name",
")",
";",
"if",
"(",
"bi... | Closes the outbound socket binding connection.
@throws IOException | [
"Closes",
"the",
"outbound",
"socket",
"binding",
"connection",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/OutboundSocketBinding.java#L247-L253 | train |
wildfly/wildfly-core | logging/src/main/java/org/jboss/as/logging/Logging.java | Logging.requiresReload | public static boolean requiresReload(final Set<Flag> flags) {
return flags.contains(Flag.RESTART_ALL_SERVICES) || flags.contains(Flag.RESTART_RESOURCE_SERVICES);
} | java | public static boolean requiresReload(final Set<Flag> flags) {
return flags.contains(Flag.RESTART_ALL_SERVICES) || flags.contains(Flag.RESTART_RESOURCE_SERVICES);
} | [
"public",
"static",
"boolean",
"requiresReload",
"(",
"final",
"Set",
"<",
"Flag",
">",
"flags",
")",
"{",
"return",
"flags",
".",
"contains",
"(",
"Flag",
".",
"RESTART_ALL_SERVICES",
")",
"||",
"flags",
".",
"contains",
"(",
"Flag",
".",
"RESTART_RESOURCE_... | Checks to see within the flags if a reload, i.e. not a full restart, is required.
@param flags the flags to check
@return {@code true} if a reload is required, otherwise {@code false} | [
"Checks",
"to",
"see",
"within",
"the",
"flags",
"if",
"a",
"reload",
"i",
".",
"e",
".",
"not",
"a",
"full",
"restart",
"is",
"required",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/Logging.java#L61-L63 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentityImpl.java | InstalledIdentityImpl.updateState | @Override
protected void updateState(final String name, final InstallationModificationImpl modification, final InstallationModificationImpl.InstallationState state) {
final PatchableTarget.TargetInfo identityInfo = modification.getModifiedState();
this.identity = new Identity() {
@Override
public String getVersion() {
return modification.getVersion();
}
@Override
public String getName() {
return name;
}
@Override
public TargetInfo loadTargetInfo() throws IOException {
return identityInfo;
}
@Override
public DirectoryStructure getDirectoryStructure() {
return modification.getDirectoryStructure();
}
};
this.allPatches = Collections.unmodifiableList(modification.getAllPatches());
this.layers.clear();
for (final Map.Entry<String, MutableTargetImpl> entry : state.getLayers().entrySet()) {
final String layerName = entry.getKey();
final MutableTargetImpl target = entry.getValue();
putLayer(layerName, new LayerInfo(layerName, target.getModifiedState(), target.getDirectoryStructure()));
}
this.addOns.clear();
for (final Map.Entry<String, MutableTargetImpl> entry : state.getAddOns().entrySet()) {
final String addOnName = entry.getKey();
final MutableTargetImpl target = entry.getValue();
putAddOn(addOnName, new LayerInfo(addOnName, target.getModifiedState(), target.getDirectoryStructure()));
}
} | java | @Override
protected void updateState(final String name, final InstallationModificationImpl modification, final InstallationModificationImpl.InstallationState state) {
final PatchableTarget.TargetInfo identityInfo = modification.getModifiedState();
this.identity = new Identity() {
@Override
public String getVersion() {
return modification.getVersion();
}
@Override
public String getName() {
return name;
}
@Override
public TargetInfo loadTargetInfo() throws IOException {
return identityInfo;
}
@Override
public DirectoryStructure getDirectoryStructure() {
return modification.getDirectoryStructure();
}
};
this.allPatches = Collections.unmodifiableList(modification.getAllPatches());
this.layers.clear();
for (final Map.Entry<String, MutableTargetImpl> entry : state.getLayers().entrySet()) {
final String layerName = entry.getKey();
final MutableTargetImpl target = entry.getValue();
putLayer(layerName, new LayerInfo(layerName, target.getModifiedState(), target.getDirectoryStructure()));
}
this.addOns.clear();
for (final Map.Entry<String, MutableTargetImpl> entry : state.getAddOns().entrySet()) {
final String addOnName = entry.getKey();
final MutableTargetImpl target = entry.getValue();
putAddOn(addOnName, new LayerInfo(addOnName, target.getModifiedState(), target.getDirectoryStructure()));
}
} | [
"@",
"Override",
"protected",
"void",
"updateState",
"(",
"final",
"String",
"name",
",",
"final",
"InstallationModificationImpl",
"modification",
",",
"final",
"InstallationModificationImpl",
".",
"InstallationState",
"state",
")",
"{",
"final",
"PatchableTarget",
".",... | Update the installed identity using the modified state from the modification.
@param name the identity name
@param modification the modification
@param state the installation state
@return the installed identity | [
"Update",
"the",
"installed",
"identity",
"using",
"the",
"modified",
"state",
"from",
"the",
"modification",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentityImpl.java#L115-L153 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java | AffectedDeploymentOverlay.listAllLinks | public static Set<String> listAllLinks(OperationContext context, String overlay) {
Set<String> serverGoupNames = listServerGroupsReferencingOverlay(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS), overlay);
Set<String> links = new HashSet<>();
for (String serverGoupName : serverGoupNames) {
links.addAll(listLinks(context, PathAddress.pathAddress(
PathElement.pathElement(SERVER_GROUP, serverGoupName),
PathElement.pathElement(DEPLOYMENT_OVERLAY, overlay))));
}
return links;
} | java | public static Set<String> listAllLinks(OperationContext context, String overlay) {
Set<String> serverGoupNames = listServerGroupsReferencingOverlay(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS), overlay);
Set<String> links = new HashSet<>();
for (String serverGoupName : serverGoupNames) {
links.addAll(listLinks(context, PathAddress.pathAddress(
PathElement.pathElement(SERVER_GROUP, serverGoupName),
PathElement.pathElement(DEPLOYMENT_OVERLAY, overlay))));
}
return links;
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"listAllLinks",
"(",
"OperationContext",
"context",
",",
"String",
"overlay",
")",
"{",
"Set",
"<",
"String",
">",
"serverGoupNames",
"=",
"listServerGroupsReferencingOverlay",
"(",
"context",
".",
"readResourceFromRoot... | Returns all the deployment runtime names associated with an overlay accross all server groups.
@param context the current OperationContext.
@param overlay the name of the overlay.
@return all the deployment runtime names associated with an overlay accross all server groups. | [
"Returns",
"all",
"the",
"deployment",
"runtime",
"names",
"associated",
"with",
"an",
"overlay",
"accross",
"all",
"server",
"groups",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L73-L82 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java | AffectedDeploymentOverlay.listLinks | public static Set<String> listLinks(OperationContext context, PathAddress overlayAddress) {
Resource overlayResource = context.readResourceFromRoot(overlayAddress);
if (overlayResource.hasChildren(DEPLOYMENT)) {
return overlayResource.getChildrenNames(DEPLOYMENT);
}
return Collections.emptySet();
} | java | public static Set<String> listLinks(OperationContext context, PathAddress overlayAddress) {
Resource overlayResource = context.readResourceFromRoot(overlayAddress);
if (overlayResource.hasChildren(DEPLOYMENT)) {
return overlayResource.getChildrenNames(DEPLOYMENT);
}
return Collections.emptySet();
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"listLinks",
"(",
"OperationContext",
"context",
",",
"PathAddress",
"overlayAddress",
")",
"{",
"Resource",
"overlayResource",
"=",
"context",
".",
"readResourceFromRoot",
"(",
"overlayAddress",
")",
";",
"if",
"(",
... | Returns all the deployment runtime names associated with an overlay.
@param context the current OperationContext.
@param overlayAddress the address for the averlay.
@return all the deployment runtime names associated with an overlay. | [
"Returns",
"all",
"the",
"deployment",
"runtime",
"names",
"associated",
"with",
"an",
"overlay",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L91-L97 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java | AffectedDeploymentOverlay.redeployDeployments | public static void redeployDeployments(OperationContext context, PathAddress deploymentsRootAddress, Set<String> deploymentNames) throws OperationFailedException {
for (String deploymentName : deploymentNames) {
PathAddress address = deploymentsRootAddress.append(DEPLOYMENT, deploymentName);
OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(address, REDEPLOY);
ModelNode operation = addRedeployStep(address);
ServerLogger.AS_ROOT_LOGGER.debugf("Redeploying %s at address %s with handler %s", deploymentName, address, handler);
assert handler != null;
assert operation.isDefined();
context.addStep(operation, handler, OperationContext.Stage.MODEL);
}
} | java | public static void redeployDeployments(OperationContext context, PathAddress deploymentsRootAddress, Set<String> deploymentNames) throws OperationFailedException {
for (String deploymentName : deploymentNames) {
PathAddress address = deploymentsRootAddress.append(DEPLOYMENT, deploymentName);
OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(address, REDEPLOY);
ModelNode operation = addRedeployStep(address);
ServerLogger.AS_ROOT_LOGGER.debugf("Redeploying %s at address %s with handler %s", deploymentName, address, handler);
assert handler != null;
assert operation.isDefined();
context.addStep(operation, handler, OperationContext.Stage.MODEL);
}
} | [
"public",
"static",
"void",
"redeployDeployments",
"(",
"OperationContext",
"context",
",",
"PathAddress",
"deploymentsRootAddress",
",",
"Set",
"<",
"String",
">",
"deploymentNames",
")",
"throws",
"OperationFailedException",
"{",
"for",
"(",
"String",
"deploymentName"... | We are adding a redeploy operation step for each specified deployment runtime name.
@param context
@param deploymentsRootAddress
@param deploymentNames
@throws OperationFailedException | [
"We",
"are",
"adding",
"a",
"redeploy",
"operation",
"step",
"for",
"each",
"specified",
"deployment",
"runtime",
"name",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L128-L138 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java | AffectedDeploymentOverlay.redeployLinksAndTransformOperation | public static void redeployLinksAndTransformOperation(OperationContext context, ModelNode removeOperation, PathAddress deploymentsRootAddress, Set<String> runtimeNames) throws OperationFailedException {
Set<String> deploymentNames = listDeployments(context.readResourceFromRoot(deploymentsRootAddress), runtimeNames);
Operations.CompositeOperationBuilder opBuilder = Operations.CompositeOperationBuilder.create();
if (deploymentNames.isEmpty()) {
for (String s : runtimeNames) {
ServerLogger.ROOT_LOGGER.debugf("We haven't found any deployment for %s in server-group %s", s, deploymentsRootAddress.getLastElement().getValue());
}
}
if(removeOperation != null) {
opBuilder.addStep(removeOperation);
}
for (String deploymentName : deploymentNames) {
opBuilder.addStep(addRedeployStep(deploymentsRootAddress.append(DEPLOYMENT, deploymentName)));
}
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
final ModelNode slave = opBuilder.build().getOperation();
transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress()));
} | java | public static void redeployLinksAndTransformOperation(OperationContext context, ModelNode removeOperation, PathAddress deploymentsRootAddress, Set<String> runtimeNames) throws OperationFailedException {
Set<String> deploymentNames = listDeployments(context.readResourceFromRoot(deploymentsRootAddress), runtimeNames);
Operations.CompositeOperationBuilder opBuilder = Operations.CompositeOperationBuilder.create();
if (deploymentNames.isEmpty()) {
for (String s : runtimeNames) {
ServerLogger.ROOT_LOGGER.debugf("We haven't found any deployment for %s in server-group %s", s, deploymentsRootAddress.getLastElement().getValue());
}
}
if(removeOperation != null) {
opBuilder.addStep(removeOperation);
}
for (String deploymentName : deploymentNames) {
opBuilder.addStep(addRedeployStep(deploymentsRootAddress.append(DEPLOYMENT, deploymentName)));
}
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
final ModelNode slave = opBuilder.build().getOperation();
transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress()));
} | [
"public",
"static",
"void",
"redeployLinksAndTransformOperation",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"removeOperation",
",",
"PathAddress",
"deploymentsRootAddress",
",",
"Set",
"<",
"String",
">",
"runtimeNames",
")",
"throws",
"OperationFailedException"... | It will look for all the deployments under the deploymentsRootAddress with a runtimeName in the specified list of
runtime names and then transform the operation so that every server having those deployments will redeploy the
affected deployments.
@see #transformOperation
@param removeOperation
@param context
@param deploymentsRootAddress
@param runtimeNames
@throws OperationFailedException | [
"It",
"will",
"look",
"for",
"all",
"the",
"deployments",
"under",
"the",
"deploymentsRootAddress",
"with",
"a",
"runtimeName",
"in",
"the",
"specified",
"list",
"of",
"runtime",
"names",
"and",
"then",
"transform",
"the",
"operation",
"so",
"that",
"every",
"... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L196-L216 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java | AffectedDeploymentOverlay.listDeployments | public static Set<String> listDeployments(Resource deploymentRootResource, Set<String> runtimeNames) {
Set<Pattern> set = new HashSet<>();
for (String wildcardExpr : runtimeNames) {
Pattern pattern = DeploymentOverlayIndex.getPattern(wildcardExpr);
set.add(pattern);
}
return listDeploymentNames(deploymentRootResource, set);
} | java | public static Set<String> listDeployments(Resource deploymentRootResource, Set<String> runtimeNames) {
Set<Pattern> set = new HashSet<>();
for (String wildcardExpr : runtimeNames) {
Pattern pattern = DeploymentOverlayIndex.getPattern(wildcardExpr);
set.add(pattern);
}
return listDeploymentNames(deploymentRootResource, set);
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"listDeployments",
"(",
"Resource",
"deploymentRootResource",
",",
"Set",
"<",
"String",
">",
"runtimeNames",
")",
"{",
"Set",
"<",
"Pattern",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"... | Returns the deployment names with the specified runtime names at the specified deploymentRootAddress.
@param deploymentRootResource
@param runtimeNames
@return the deployment names with the specified runtime names at the specified deploymentRootAddress. | [
"Returns",
"the",
"deployment",
"names",
"with",
"the",
"specified",
"runtime",
"names",
"at",
"the",
"specified",
"deploymentRootAddress",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L225-L232 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java | CommandExecutor.execute | public void execute(CommandHandler handler,
int timeout,
TimeUnit unit) throws
CommandLineException,
InterruptedException, ExecutionException, TimeoutException {
ExecutableBuilder builder = new ExecutableBuilder() {
CommandContext c = newTimeoutCommandContext(ctx);
@Override
public Executable build() {
return () -> {
handler.handle(c);
};
}
@Override
public CommandContext getCommandContext() {
return c;
}
};
execute(builder, timeout, unit);
} | java | public void execute(CommandHandler handler,
int timeout,
TimeUnit unit) throws
CommandLineException,
InterruptedException, ExecutionException, TimeoutException {
ExecutableBuilder builder = new ExecutableBuilder() {
CommandContext c = newTimeoutCommandContext(ctx);
@Override
public Executable build() {
return () -> {
handler.handle(c);
};
}
@Override
public CommandContext getCommandContext() {
return c;
}
};
execute(builder, timeout, unit);
} | [
"public",
"void",
"execute",
"(",
"CommandHandler",
"handler",
",",
"int",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"CommandLineException",
",",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutException",
"{",
"ExecutableBuilder",
"builder",
... | public for testing purpose | [
"public",
"for",
"testing",
"purpose"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java#L675-L695 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java | CommandExecutor.execute | void execute(ExecutableBuilder builder,
int timeout,
TimeUnit unit) throws
CommandLineException,
InterruptedException, ExecutionException, TimeoutException {
Future<Void> task = executorService.submit(() -> {
builder.build().execute();
return null;
});
try {
if (timeout <= 0) { //Synchronous
task.get();
} else { // Guarded execution
try {
task.get(timeout, unit);
} catch (TimeoutException ex) {
// First make the context unusable
CommandContext c = builder.getCommandContext();
if (c instanceof TimeoutCommandContext) {
((TimeoutCommandContext) c).timeout();
}
// Then cancel the task.
task.cancel(true);
throw ex;
}
}
} catch (InterruptedException ex) {
// Could have been interrupted by user (Ctrl-C)
Thread.currentThread().interrupt();
cancelTask(task, builder.getCommandContext(), null);
// Interrupt running operation.
CommandContext c = builder.getCommandContext();
if (c instanceof TimeoutCommandContext) {
((TimeoutCommandContext) c).interrupted();
}
throw ex;
}
} | java | void execute(ExecutableBuilder builder,
int timeout,
TimeUnit unit) throws
CommandLineException,
InterruptedException, ExecutionException, TimeoutException {
Future<Void> task = executorService.submit(() -> {
builder.build().execute();
return null;
});
try {
if (timeout <= 0) { //Synchronous
task.get();
} else { // Guarded execution
try {
task.get(timeout, unit);
} catch (TimeoutException ex) {
// First make the context unusable
CommandContext c = builder.getCommandContext();
if (c instanceof TimeoutCommandContext) {
((TimeoutCommandContext) c).timeout();
}
// Then cancel the task.
task.cancel(true);
throw ex;
}
}
} catch (InterruptedException ex) {
// Could have been interrupted by user (Ctrl-C)
Thread.currentThread().interrupt();
cancelTask(task, builder.getCommandContext(), null);
// Interrupt running operation.
CommandContext c = builder.getCommandContext();
if (c instanceof TimeoutCommandContext) {
((TimeoutCommandContext) c).interrupted();
}
throw ex;
}
} | [
"void",
"execute",
"(",
"ExecutableBuilder",
"builder",
",",
"int",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"CommandLineException",
",",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutException",
"{",
"Future",
"<",
"Void",
">",
"task",
... | The CommandContext can be retrieved thatnks to the ExecutableBuilder. | [
"The",
"CommandContext",
"can",
"be",
"retrieved",
"thatnks",
"to",
"the",
"ExecutableBuilder",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/CommandExecutor.java#L702-L739 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/impl/ArgumentWithValue.java | ArgumentWithValue.getOriginalValue | public String getOriginalValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException {
String value = null;
if(parsedLine.hasProperties()) {
if(index >= 0) {
List<String> others = parsedLine.getOtherProperties();
if(others.size() > index) {
return others.get(index);
}
}
value = parsedLine.getPropertyValue(fullName);
if(value == null && shortName != null) {
value = parsedLine.getPropertyValue(shortName);
}
}
if(required && value == null && !isPresent(parsedLine)) {
StringBuilder buf = new StringBuilder();
buf.append("Required argument ");
buf.append('\'').append(fullName).append('\'');
buf.append(" is missing.");
throw new CommandFormatException(buf.toString());
}
return value;
} | java | public String getOriginalValue(ParsedCommandLine parsedLine, boolean required) throws CommandFormatException {
String value = null;
if(parsedLine.hasProperties()) {
if(index >= 0) {
List<String> others = parsedLine.getOtherProperties();
if(others.size() > index) {
return others.get(index);
}
}
value = parsedLine.getPropertyValue(fullName);
if(value == null && shortName != null) {
value = parsedLine.getPropertyValue(shortName);
}
}
if(required && value == null && !isPresent(parsedLine)) {
StringBuilder buf = new StringBuilder();
buf.append("Required argument ");
buf.append('\'').append(fullName).append('\'');
buf.append(" is missing.");
throw new CommandFormatException(buf.toString());
}
return value;
} | [
"public",
"String",
"getOriginalValue",
"(",
"ParsedCommandLine",
"parsedLine",
",",
"boolean",
"required",
")",
"throws",
"CommandFormatException",
"{",
"String",
"value",
"=",
"null",
";",
"if",
"(",
"parsedLine",
".",
"hasProperties",
"(",
")",
")",
"{",
"if"... | Returns value as it appeared on the command line with escape sequences
and system properties not resolved. The variables, though, are resolved
during the initial parsing of the command line.
@param parsedLine parsed command line
@param required whether the argument is required
@return argument value as it appears on the command line
@throws CommandFormatException in case the required argument is missing | [
"Returns",
"value",
"as",
"it",
"appeared",
"on",
"the",
"command",
"line",
"with",
"escape",
"sequences",
"and",
"system",
"properties",
"not",
"resolved",
".",
"The",
"variables",
"though",
"are",
"resolved",
"during",
"the",
"initial",
"parsing",
"of",
"the... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/ArgumentWithValue.java#L159-L183 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/SystemExiter.java | SystemExiter.logBeforeExit | public static void logBeforeExit(ExitLogger logger) {
try {
if (logged.compareAndSet(false, true)) {
logger.logExit();
}
} catch (Throwable ignored){
// ignored
}
} | java | public static void logBeforeExit(ExitLogger logger) {
try {
if (logged.compareAndSet(false, true)) {
logger.logExit();
}
} catch (Throwable ignored){
// ignored
}
} | [
"public",
"static",
"void",
"logBeforeExit",
"(",
"ExitLogger",
"logger",
")",
"{",
"try",
"{",
"if",
"(",
"logged",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"logger",
".",
"logExit",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Thr... | Invokes the exit logger if and only if no ExitLogger was previously invoked.
@param logger the logger. Cannot be {@code null} | [
"Invokes",
"the",
"exit",
"logger",
"if",
"and",
"only",
"if",
"no",
"ExitLogger",
"was",
"previously",
"invoked",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/SystemExiter.java#L81-L89 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java | DeploymentOverlayHandler.getName | private String getName(CommandContext ctx, boolean failInBatch) throws CommandLineException {
final ParsedCommandLine args = ctx.getParsedCommandLine();
final String name = this.name.getValue(args, true);
if (name == null) {
throw new CommandFormatException(this.name + " is missing value.");
}
if (!ctx.isBatchMode() || failInBatch) {
if (!Util.isValidPath(ctx.getModelControllerClient(), Util.DEPLOYMENT_OVERLAY, name)) {
throw new CommandFormatException("Deployment overlay " + name + " does not exist.");
}
}
return name;
} | java | private String getName(CommandContext ctx, boolean failInBatch) throws CommandLineException {
final ParsedCommandLine args = ctx.getParsedCommandLine();
final String name = this.name.getValue(args, true);
if (name == null) {
throw new CommandFormatException(this.name + " is missing value.");
}
if (!ctx.isBatchMode() || failInBatch) {
if (!Util.isValidPath(ctx.getModelControllerClient(), Util.DEPLOYMENT_OVERLAY, name)) {
throw new CommandFormatException("Deployment overlay " + name + " does not exist.");
}
}
return name;
} | [
"private",
"String",
"getName",
"(",
"CommandContext",
"ctx",
",",
"boolean",
"failInBatch",
")",
"throws",
"CommandLineException",
"{",
"final",
"ParsedCommandLine",
"args",
"=",
"ctx",
".",
"getParsedCommandLine",
"(",
")",
";",
"final",
"String",
"name",
"=",
... | Validate that the overlay exists. If it doesn't exist, throws an
exception if not in batch mode or if failInBatch is true. In batch mode,
we could be in the case that the overlay doesn't exist yet. | [
"Validate",
"that",
"the",
"overlay",
"exists",
".",
"If",
"it",
"doesn",
"t",
"exist",
"throws",
"an",
"exception",
"if",
"not",
"in",
"batch",
"mode",
"or",
"if",
"failInBatch",
"is",
"true",
".",
"In",
"batch",
"mode",
"we",
"could",
"be",
"in",
"th... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/DeploymentOverlayHandler.java#L545-L557 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java | ServiceModuleLoader.moduleSpecServiceName | public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier) {
if (!isDynamicModule(identifier)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_SPEC_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
} | java | public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier) {
if (!isDynamicModule(identifier)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_SPEC_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
} | [
"public",
"static",
"ServiceName",
"moduleSpecServiceName",
"(",
"ModuleIdentifier",
"identifier",
")",
"{",
"if",
"(",
"!",
"isDynamicModule",
"(",
"identifier",
")",
")",
"{",
"throw",
"ServerLogger",
".",
"ROOT_LOGGER",
".",
"missingModulePrefix",
"(",
"identifie... | Returns the corresponding ModuleSpec service name for the given module.
@param identifier The module identifier
@return The service name of the ModuleSpec service | [
"Returns",
"the",
"corresponding",
"ModuleSpec",
"service",
"name",
"for",
"the",
"given",
"module",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java#L214-L219 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java | ServiceModuleLoader.moduleResolvedServiceName | public static ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) {
if (!isDynamicModule(identifier)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
} | java | public static ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) {
if (!isDynamicModule(identifier)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
} | [
"public",
"static",
"ServiceName",
"moduleResolvedServiceName",
"(",
"ModuleIdentifier",
"identifier",
")",
"{",
"if",
"(",
"!",
"isDynamicModule",
"(",
"identifier",
")",
")",
"{",
"throw",
"ServerLogger",
".",
"ROOT_LOGGER",
".",
"missingModulePrefix",
"(",
"ident... | Returns the corresponding module resolved service name for the given module.
The module resolved service is basically a latch that prevents the module from being loaded
until all the transitive dependencies that it depends upon have have their module spec services
come up.
@param identifier The module identifier
@return The service name of the ModuleSpec service | [
"Returns",
"the",
"corresponding",
"module",
"resolved",
"service",
"name",
"for",
"the",
"given",
"module",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java#L238-L243 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java | ServiceModuleLoader.moduleServiceName | public static ServiceName moduleServiceName(ModuleIdentifier identifier) {
if (!identifier.getName().startsWith(MODULE_PREFIX)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
} | java | public static ServiceName moduleServiceName(ModuleIdentifier identifier) {
if (!identifier.getName().startsWith(MODULE_PREFIX)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
} | [
"public",
"static",
"ServiceName",
"moduleServiceName",
"(",
"ModuleIdentifier",
"identifier",
")",
"{",
"if",
"(",
"!",
"identifier",
".",
"getName",
"(",
")",
".",
"startsWith",
"(",
"MODULE_PREFIX",
")",
")",
"{",
"throw",
"ServerLogger",
".",
"ROOT_LOGGER",
... | Returns the corresponding ModuleLoadService service name for the given module.
@param identifier The module identifier
@return The service name of the ModuleLoadService service | [
"Returns",
"the",
"corresponding",
"ModuleLoadService",
"service",
"name",
"for",
"the",
"given",
"module",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/moduleservice/ServiceModuleLoader.java#L258-L263 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorProcessor.java | ServiceActivatorProcessor.deploy | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);
if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
return; // Skip it if it has not been marked
}
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module == null) {
return; // Skip deployments with no module
}
AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);
List<String> serviceAcitvatorList = new ArrayList<String>();
if (duList!=null && !duList.isEmpty()) {
for (DeploymentUnit du : duList) {
ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES);
for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
serviceAcitvatorList.add(serv);
}
}
}
ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
if (WildFlySecurityManager.isChecking()) {
//service registry allows you to modify internal server state across all deployments
//if a security manager is present we use a version that has permission checks
serviceRegistry = new SecuredServiceRegistry(serviceRegistry);
}
final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) {
try {
for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) {
serviceActivator.activate(serviceActivatorContext);
break;
}
}
} catch (ServiceRegistryException e) {
throw new DeploymentUnitProcessingException(e);
}
}
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
} | java | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);
if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
return; // Skip it if it has not been marked
}
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module == null) {
return; // Skip deployments with no module
}
AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);
List<String> serviceAcitvatorList = new ArrayList<String>();
if (duList!=null && !duList.isEmpty()) {
for (DeploymentUnit du : duList) {
ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES);
for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
serviceAcitvatorList.add(serv);
}
}
}
ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
if (WildFlySecurityManager.isChecking()) {
//service registry allows you to modify internal server state across all deployments
//if a security manager is present we use a version that has permission checks
serviceRegistry = new SecuredServiceRegistry(serviceRegistry);
}
final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) {
try {
for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) {
serviceActivator.activate(serviceActivatorContext);
break;
}
}
} catch (ServiceRegistryException e) {
throw new DeploymentUnitProcessingException(e);
}
}
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
} | [
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"final",
"ServicesAttachment",
"s... | If the deployment has a module attached it will ask the module to load the ServiceActivator services.
@param phaseContext the deployment unit context | [
"If",
"the",
"deployment",
"has",
"a",
"module",
"attached",
"it",
"will",
"ask",
"the",
"module",
"to",
"load",
"the",
"ServiceActivator",
"services",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/service/ServiceActivatorProcessor.java#L53-L102 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java | HostControllerConnection.openConnection | synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception {
boolean ok = false;
final Connection connection = connectionManager.connect();
try {
channelHandler.executeRequest(new ServerRegisterRequest(), null, callback);
// HC is the same version, so it will support sending the subject
channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE);
channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE);
channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport));
ok = true;
} finally {
if(!ok) {
connection.close();
}
}
} | java | synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception {
boolean ok = false;
final Connection connection = connectionManager.connect();
try {
channelHandler.executeRequest(new ServerRegisterRequest(), null, callback);
// HC is the same version, so it will support sending the subject
channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE);
channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE);
channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport));
ok = true;
} finally {
if(!ok) {
connection.close();
}
}
} | [
"synchronized",
"void",
"openConnection",
"(",
"final",
"ModelController",
"controller",
",",
"final",
"ActiveOperation",
".",
"CompletedCallback",
"<",
"ModelNode",
">",
"callback",
")",
"throws",
"Exception",
"{",
"boolean",
"ok",
"=",
"false",
";",
"final",
"Co... | Connect to the HC and retrieve the current model updates.
@param controller the server controller
@param callback the operation completed callback
@throws IOException for any error | [
"Connect",
"to",
"the",
"HC",
"and",
"retrieve",
"the",
"current",
"model",
"updates",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L126-L141 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java | HostControllerConnection.asyncReconnect | synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) {
if (getState() != State.OPEN) {
return;
}
// Update the configuration with the new credentials
final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration);
config.setCallbackHandler(createClientCallbackHandler(userName, authKey));
config.setUri(reconnectUri);
this.configuration = config;
final ReconnectRunner reconnectTask = this.reconnectRunner;
if (reconnectTask == null) {
final ReconnectRunner task = new ReconnectRunner();
task.callback = callback;
task.future = executorService.submit(task);
} else {
reconnectTask.callback = callback;
}
} | java | synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) {
if (getState() != State.OPEN) {
return;
}
// Update the configuration with the new credentials
final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration);
config.setCallbackHandler(createClientCallbackHandler(userName, authKey));
config.setUri(reconnectUri);
this.configuration = config;
final ReconnectRunner reconnectTask = this.reconnectRunner;
if (reconnectTask == null) {
final ReconnectRunner task = new ReconnectRunner();
task.callback = callback;
task.future = executorService.submit(task);
} else {
reconnectTask.callback = callback;
}
} | [
"synchronized",
"void",
"asyncReconnect",
"(",
"final",
"URI",
"reconnectUri",
",",
"String",
"authKey",
",",
"final",
"ReconnectCallback",
"callback",
")",
"{",
"if",
"(",
"getState",
"(",
")",
"!=",
"State",
".",
"OPEN",
")",
"{",
"return",
";",
"}",
"//... | This continuously tries to reconnect in a separate thread and will only stop if the connection was established
successfully or the server gets shutdown. If there is currently a reconnect task active the connection paramaters
and callback will get updated.
@param reconnectUri the updated connection uri
@param authKey the updated authentication key
@param callback the current callback | [
"This",
"continuously",
"tries",
"to",
"reconnect",
"in",
"a",
"separate",
"thread",
"and",
"will",
"only",
"stop",
"if",
"the",
"connection",
"was",
"established",
"successfully",
"or",
"the",
"server",
"gets",
"shutdown",
".",
"If",
"there",
"is",
"currently... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L152-L170 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java | HostControllerConnection.doReConnect | synchronized boolean doReConnect() throws IOException {
// In case we are still connected, test the connection and see if we can reuse it
if(connectionManager.isConnected()) {
try {
final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult();
result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much
return true;
} catch (Exception e) {
ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to ping the host-controller, going to reconnect");
}
// Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect
final Connection connection = connectionManager.getConnection();
StreamUtils.safeClose(connection);
if(connection != null) {
try {
// Wait for the connection to be closed
connection.awaitClosed();
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
}
}
boolean ok = false;
final Connection connection = connectionManager.connect();
try {
// Reconnect to the host-controller
final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null);
try {
boolean inSync = result.getResult().get();
ok = true;
reconnectRunner = null;
return inSync;
} catch (ExecutionException e) {
throw new IOException(e);
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
} finally {
if(!ok) {
StreamUtils.safeClose(connection);
}
}
} | java | synchronized boolean doReConnect() throws IOException {
// In case we are still connected, test the connection and see if we can reuse it
if(connectionManager.isConnected()) {
try {
final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult();
result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much
return true;
} catch (Exception e) {
ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to ping the host-controller, going to reconnect");
}
// Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect
final Connection connection = connectionManager.getConnection();
StreamUtils.safeClose(connection);
if(connection != null) {
try {
// Wait for the connection to be closed
connection.awaitClosed();
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
}
}
boolean ok = false;
final Connection connection = connectionManager.connect();
try {
// Reconnect to the host-controller
final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null);
try {
boolean inSync = result.getResult().get();
ok = true;
reconnectRunner = null;
return inSync;
} catch (ExecutionException e) {
throw new IOException(e);
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
} finally {
if(!ok) {
StreamUtils.safeClose(connection);
}
}
} | [
"synchronized",
"boolean",
"doReConnect",
"(",
")",
"throws",
"IOException",
"{",
"// In case we are still connected, test the connection and see if we can reuse it",
"if",
"(",
"connectionManager",
".",
"isConnected",
"(",
")",
")",
"{",
"try",
"{",
"final",
"Future",
"<... | Reconnect to the HC.
@return whether the server is still in sync
@throws IOException | [
"Reconnect",
"to",
"the",
"HC",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L178-L222 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java | HostControllerConnection.started | synchronized void started() {
try {
if(isConnected()) {
channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await();
}
} catch (Exception e) {
ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification");
}
} | java | synchronized void started() {
try {
if(isConnected()) {
channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await();
}
} catch (Exception e) {
ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification");
}
} | [
"synchronized",
"void",
"started",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isConnected",
"(",
")",
")",
"{",
"channelHandler",
".",
"executeRequest",
"(",
"new",
"ServerStartedRequest",
"(",
")",
",",
"null",
")",
".",
"getResult",
"(",
")",
".",
"await",... | Send the started notification | [
"Send",
"the",
"started",
"notification"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L227-L235 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java | ServerTaskExecutor.executeTask | public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) {
try {
return execute(listener, task.getServerIdentity(), task.getOperation());
} catch (OperationFailedException e) {
// Handle failures operation transformation failures
final ServerIdentity identity = task.getServerIdentity();
final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT);
final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
listener.operationPrepared(result);
recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT));
return 1; // 1 ms timeout since there is no reason to wait for the locally stored result
}
} | java | public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) {
try {
return execute(listener, task.getServerIdentity(), task.getOperation());
} catch (OperationFailedException e) {
// Handle failures operation transformation failures
final ServerIdentity identity = task.getServerIdentity();
final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT);
final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
listener.operationPrepared(result);
recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT));
return 1; // 1 ms timeout since there is no reason to wait for the locally stored result
}
} | [
"public",
"int",
"executeTask",
"(",
"final",
"TransactionalProtocolClient",
".",
"TransactionalOperationListener",
"<",
"ServerOperation",
">",
"listener",
",",
"final",
"ServerUpdateTask",
"task",
")",
"{",
"try",
"{",
"return",
"execute",
"(",
"listener",
",",
"t... | Execute a server task.
@param listener the transactional server listener
@param task the server task
@return time to wait in ms for a response from the server, or {@code -1} if the task execution failed locally | [
"Execute",
"a",
"server",
"task",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L81-L94 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java | ServerTaskExecutor.executeOperation | protected boolean executeOperation(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, TransactionalProtocolClient client, final ServerIdentity identity, final ModelNode operation, final OperationResultTransformer transformer) {
if(client == null) {
return false;
}
final OperationMessageHandler messageHandler = new DelegatingMessageHandler(context);
final OperationAttachments operationAttachments = new DelegatingOperationAttachments(context);
final ServerOperation serverOperation = new ServerOperation(identity, operation, messageHandler, operationAttachments, transformer);
try {
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Sending %s to %s", operation, identity);
final Future<OperationResponse> result = client.execute(listener, serverOperation);
recordExecutedRequest(new ExecutedServerRequest(identity, result, transformer));
} catch (IOException e) {
final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
listener.operationPrepared(result);
recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), transformer));
}
return true;
} | java | protected boolean executeOperation(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, TransactionalProtocolClient client, final ServerIdentity identity, final ModelNode operation, final OperationResultTransformer transformer) {
if(client == null) {
return false;
}
final OperationMessageHandler messageHandler = new DelegatingMessageHandler(context);
final OperationAttachments operationAttachments = new DelegatingOperationAttachments(context);
final ServerOperation serverOperation = new ServerOperation(identity, operation, messageHandler, operationAttachments, transformer);
try {
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Sending %s to %s", operation, identity);
final Future<OperationResponse> result = client.execute(listener, serverOperation);
recordExecutedRequest(new ExecutedServerRequest(identity, result, transformer));
} catch (IOException e) {
final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
listener.operationPrepared(result);
recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), transformer));
}
return true;
} | [
"protected",
"boolean",
"executeOperation",
"(",
"final",
"TransactionalProtocolClient",
".",
"TransactionalOperationListener",
"<",
"ServerOperation",
">",
"listener",
",",
"TransactionalProtocolClient",
"client",
",",
"final",
"ServerIdentity",
"identity",
",",
"final",
"... | Execute the operation.
@param listener the transactional operation listener
@param client the transactional protocol client
@param identity the server identity
@param operation the operation
@param transformer the operation result transformer
@return whether the operation was executed | [
"Execute",
"the",
"operation",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L113-L130 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java | ServerTaskExecutor.recordPreparedOperation | void recordPreparedOperation(final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> preparedOperation) {
recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(preparedOperation));
} | java | void recordPreparedOperation(final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> preparedOperation) {
recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(preparedOperation));
} | [
"void",
"recordPreparedOperation",
"(",
"final",
"TransactionalProtocolClient",
".",
"PreparedOperation",
"<",
"ServerTaskExecutor",
".",
"ServerOperation",
">",
"preparedOperation",
")",
"{",
"recordPreparedTask",
"(",
"new",
"ServerTaskExecutor",
".",
"ServerPreparedRespons... | Record a prepare operation.
@param preparedOperation the prepared operation | [
"Record",
"a",
"prepare",
"operation",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L148-L150 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java | ServerTaskExecutor.recordOperationPrepareTimeout | void recordOperationPrepareTimeout(final BlockingQueueOperationListener.FailedOperation<ServerOperation> failedOperation) {
recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(failedOperation));
// Swap out the submitted task so we don't wait for the final result. Use a future the returns
// prepared response
ServerIdentity identity = failedOperation.getOperation().getIdentity();
AsyncFuture<OperationResponse> finalResult = failedOperation.getFinalResult();
synchronized (submittedTasks) {
submittedTasks.put(identity, new ServerTaskExecutor.ExecutedServerRequest(identity, finalResult));
}
} | java | void recordOperationPrepareTimeout(final BlockingQueueOperationListener.FailedOperation<ServerOperation> failedOperation) {
recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(failedOperation));
// Swap out the submitted task so we don't wait for the final result. Use a future the returns
// prepared response
ServerIdentity identity = failedOperation.getOperation().getIdentity();
AsyncFuture<OperationResponse> finalResult = failedOperation.getFinalResult();
synchronized (submittedTasks) {
submittedTasks.put(identity, new ServerTaskExecutor.ExecutedServerRequest(identity, finalResult));
}
} | [
"void",
"recordOperationPrepareTimeout",
"(",
"final",
"BlockingQueueOperationListener",
".",
"FailedOperation",
"<",
"ServerOperation",
">",
"failedOperation",
")",
"{",
"recordPreparedTask",
"(",
"new",
"ServerTaskExecutor",
".",
"ServerPreparedResponse",
"(",
"failedOperat... | Record a prepare operation timeout.
@param failedOperation the prepared operation | [
"Record",
"a",
"prepare",
"operation",
"timeout",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L157-L166 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/installation/InstallationManagerService.java | InstallationManagerService.installService | public static ServiceController<InstallationManager> installService(ServiceTarget serviceTarget) {
final InstallationManagerService service = new InstallationManagerService();
return serviceTarget.addService(InstallationManagerService.NAME, service)
.addDependency(JBOSS_PRODUCT_CONFIG_SERVICE, ProductConfig.class, service.productConfig)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
} | java | public static ServiceController<InstallationManager> installService(ServiceTarget serviceTarget) {
final InstallationManagerService service = new InstallationManagerService();
return serviceTarget.addService(InstallationManagerService.NAME, service)
.addDependency(JBOSS_PRODUCT_CONFIG_SERVICE, ProductConfig.class, service.productConfig)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
} | [
"public",
"static",
"ServiceController",
"<",
"InstallationManager",
">",
"installService",
"(",
"ServiceTarget",
"serviceTarget",
")",
"{",
"final",
"InstallationManagerService",
"service",
"=",
"new",
"InstallationManagerService",
"(",
")",
";",
"return",
"serviceTarget... | Install the installation manager service.
@param serviceTarget
@return the service controller for the installed installation manager | [
"Install",
"the",
"installation",
"manager",
"service",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/InstallationManagerService.java#L48-L54 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java | ClassReflectionIndex.getMethod | public Method getMethod(Method method) {
return getMethod(method.getReturnType(), method.getName(), method.getParameterTypes());
} | java | public Method getMethod(Method method) {
return getMethod(method.getReturnType(), method.getName(), method.getParameterTypes());
} | [
"public",
"Method",
"getMethod",
"(",
"Method",
"method",
")",
"{",
"return",
"getMethod",
"(",
"method",
".",
"getReturnType",
"(",
")",
",",
"method",
".",
"getName",
"(",
")",
",",
"method",
".",
"getParameterTypes",
"(",
")",
")",
";",
"}"
] | Get the canonical method declared on this object.
@param method the method to look up
@return the canonical method object, or {@code null} if no matching method exists | [
"Get",
"the",
"canonical",
"method",
"declared",
"on",
"this",
"object",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java#L223-L225 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java | ClassReflectionIndex.getAllMethods | public Collection<Method> getAllMethods(String name) {
final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name);
if (nameMap == null) {
return Collections.emptySet();
}
final Collection<Method> methods = new ArrayList<Method>();
for (Map<Class<?>, Method> map : nameMap.values()) {
methods.addAll(map.values());
}
return methods;
} | java | public Collection<Method> getAllMethods(String name) {
final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name);
if (nameMap == null) {
return Collections.emptySet();
}
final Collection<Method> methods = new ArrayList<Method>();
for (Map<Class<?>, Method> map : nameMap.values()) {
methods.addAll(map.values());
}
return methods;
} | [
"public",
"Collection",
"<",
"Method",
">",
"getAllMethods",
"(",
"String",
"name",
")",
"{",
"final",
"Map",
"<",
"ParamList",
",",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Method",
">",
">",
"nameMap",
"=",
"methods",
".",
"get",
"(",
"name",
")",... | Get a collection of methods declared on this object by method name.
@param name the name of the method
@return the (possibly empty) collection of methods with the given name | [
"Get",
"a",
"collection",
"of",
"methods",
"declared",
"on",
"this",
"object",
"by",
"method",
"name",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java#L309-L319 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java | ClassReflectionIndex.getAllMethods | public Collection<Method> getAllMethods(String name, int paramCount) {
final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name);
if (nameMap == null) {
return Collections.emptySet();
}
final Collection<Method> methods = new ArrayList<Method>();
for (Map<Class<?>, Method> map : nameMap.values()) {
for (Method method : map.values()) {
if (method.getParameterTypes().length == paramCount) {
methods.add(method);
}
}
}
return methods;
} | java | public Collection<Method> getAllMethods(String name, int paramCount) {
final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name);
if (nameMap == null) {
return Collections.emptySet();
}
final Collection<Method> methods = new ArrayList<Method>();
for (Map<Class<?>, Method> map : nameMap.values()) {
for (Method method : map.values()) {
if (method.getParameterTypes().length == paramCount) {
methods.add(method);
}
}
}
return methods;
} | [
"public",
"Collection",
"<",
"Method",
">",
"getAllMethods",
"(",
"String",
"name",
",",
"int",
"paramCount",
")",
"{",
"final",
"Map",
"<",
"ParamList",
",",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Method",
">",
">",
"nameMap",
"=",
"methods",
".",
... | Get a collection of methods declared on this object by method name and parameter count.
@param name the name of the method
@param paramCount the number of parameters
@return the (possibly empty) collection of methods with the given name and parameter count | [
"Get",
"a",
"collection",
"of",
"methods",
"declared",
"on",
"this",
"object",
"by",
"method",
"name",
"and",
"parameter",
"count",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndex.java#L328-L342 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/DomainServerCommunicationServices.java | DomainServerCommunicationServices.create | public static ServiceActivator create(final ModelNode endpointConfig, final URI managementURI, final String serverName, final String serverProcessName,
final String authKey, final boolean managementSubsystemEndpoint, final Supplier<SSLContext> sslContextSupplier) {
return new DomainServerCommunicationServices(endpointConfig, managementURI, serverName, serverProcessName, authKey, managementSubsystemEndpoint, sslContextSupplier);
} | java | public static ServiceActivator create(final ModelNode endpointConfig, final URI managementURI, final String serverName, final String serverProcessName,
final String authKey, final boolean managementSubsystemEndpoint, final Supplier<SSLContext> sslContextSupplier) {
return new DomainServerCommunicationServices(endpointConfig, managementURI, serverName, serverProcessName, authKey, managementSubsystemEndpoint, sslContextSupplier);
} | [
"public",
"static",
"ServiceActivator",
"create",
"(",
"final",
"ModelNode",
"endpointConfig",
",",
"final",
"URI",
"managementURI",
",",
"final",
"String",
"serverName",
",",
"final",
"String",
"serverProcessName",
",",
"final",
"String",
"authKey",
",",
"final",
... | Create a new service activator for the domain server communication services.
@param endpointConfig the endpoint configuration
@param managementURI the management connection URI
@param serverName the server name
@param serverProcessName the server process name
@param authKey the authentication key
@param managementSubsystemEndpoint whether to use the mgmt subsystem endpoint or not
@return the service activator | [
"Create",
"a",
"new",
"service",
"activator",
"for",
"the",
"domain",
"server",
"communication",
"services",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/DomainServerCommunicationServices.java#L127-L131 | train |
wildfly/wildfly-core | network/src/main/java/org/jboss/as/network/SocketBinding.java | SocketBinding.getMulticastSocketAddress | public InetSocketAddress getMulticastSocketAddress() {
if (multicastAddress == null) {
throw MESSAGES.noMulticastBinding(name);
}
return new InetSocketAddress(multicastAddress, multicastPort);
} | java | public InetSocketAddress getMulticastSocketAddress() {
if (multicastAddress == null) {
throw MESSAGES.noMulticastBinding(name);
}
return new InetSocketAddress(multicastAddress, multicastPort);
} | [
"public",
"InetSocketAddress",
"getMulticastSocketAddress",
"(",
")",
"{",
"if",
"(",
"multicastAddress",
"==",
"null",
")",
"{",
"throw",
"MESSAGES",
".",
"noMulticastBinding",
"(",
"name",
")",
";",
"}",
"return",
"new",
"InetSocketAddress",
"(",
"multicastAddre... | Get the multicast socket address.
@return the multicast address | [
"Get",
"the",
"multicast",
"socket",
"address",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/SocketBinding.java#L139-L144 | train |
wildfly/wildfly-core | network/src/main/java/org/jboss/as/network/SocketBinding.java | SocketBinding.createServerSocket | public ServerSocket createServerSocket() throws IOException {
final ServerSocket socket = getServerSocketFactory().createServerSocket(name);
socket.bind(getSocketAddress());
return socket;
} | java | public ServerSocket createServerSocket() throws IOException {
final ServerSocket socket = getServerSocketFactory().createServerSocket(name);
socket.bind(getSocketAddress());
return socket;
} | [
"public",
"ServerSocket",
"createServerSocket",
"(",
")",
"throws",
"IOException",
"{",
"final",
"ServerSocket",
"socket",
"=",
"getServerSocketFactory",
"(",
")",
".",
"createServerSocket",
"(",
"name",
")",
";",
"socket",
".",
"bind",
"(",
"getSocketAddress",
"(... | Create and bind a server socket
@return the server socket
@throws IOException | [
"Create",
"and",
"bind",
"a",
"server",
"socket"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/SocketBinding.java#L152-L156 | train |
wildfly/wildfly-core | logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingDeploymentResources.java | LoggingDeploymentResources.registerDeploymentResource | public static void registerDeploymentResource(final DeploymentResourceSupport deploymentResourceSupport, final LoggingConfigurationService service) {
final PathElement base = PathElement.pathElement("configuration", service.getConfiguration());
deploymentResourceSupport.getDeploymentSubModel(LoggingExtension.SUBSYSTEM_NAME, base);
final LogContextConfiguration configuration = service.getValue();
// Register the child resources if the configuration is not null in cases where a log4j configuration was used
if (configuration != null) {
registerDeploymentResource(deploymentResourceSupport, base, HANDLER, configuration.getHandlerNames());
registerDeploymentResource(deploymentResourceSupport, base, LOGGER, configuration.getLoggerNames());
registerDeploymentResource(deploymentResourceSupport, base, FORMATTER, configuration.getFormatterNames());
registerDeploymentResource(deploymentResourceSupport, base, FILTER, configuration.getFilterNames());
registerDeploymentResource(deploymentResourceSupport, base, POJO, configuration.getPojoNames());
registerDeploymentResource(deploymentResourceSupport, base, ERROR_MANAGER, configuration.getErrorManagerNames());
}
} | java | public static void registerDeploymentResource(final DeploymentResourceSupport deploymentResourceSupport, final LoggingConfigurationService service) {
final PathElement base = PathElement.pathElement("configuration", service.getConfiguration());
deploymentResourceSupport.getDeploymentSubModel(LoggingExtension.SUBSYSTEM_NAME, base);
final LogContextConfiguration configuration = service.getValue();
// Register the child resources if the configuration is not null in cases where a log4j configuration was used
if (configuration != null) {
registerDeploymentResource(deploymentResourceSupport, base, HANDLER, configuration.getHandlerNames());
registerDeploymentResource(deploymentResourceSupport, base, LOGGER, configuration.getLoggerNames());
registerDeploymentResource(deploymentResourceSupport, base, FORMATTER, configuration.getFormatterNames());
registerDeploymentResource(deploymentResourceSupport, base, FILTER, configuration.getFilterNames());
registerDeploymentResource(deploymentResourceSupport, base, POJO, configuration.getPojoNames());
registerDeploymentResource(deploymentResourceSupport, base, ERROR_MANAGER, configuration.getErrorManagerNames());
}
} | [
"public",
"static",
"void",
"registerDeploymentResource",
"(",
"final",
"DeploymentResourceSupport",
"deploymentResourceSupport",
",",
"final",
"LoggingConfigurationService",
"service",
")",
"{",
"final",
"PathElement",
"base",
"=",
"PathElement",
".",
"pathElement",
"(",
... | Registers the deployment resources needed.
@param deploymentResourceSupport the deployment resource support
@param service the service, which may be {@code null}, used to find the resource names that need to be registered | [
"Registers",
"the",
"deployment",
"resources",
"needed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingDeploymentResources.java#L110-L123 | train |
wildfly/wildfly-core | domain-http/interface/src/main/java/org/jboss/as/domain/http/server/DomainUtil.java | DomainUtil.constructUrl | public static String constructUrl(final HttpServerExchange exchange, final String path) {
final HeaderMap headers = exchange.getRequestHeaders();
String host = headers.getFirst(HOST);
String protocol = exchange.getConnection().getSslSessionInfo() != null ? "https" : "http";
return protocol + "://" + host + path;
} | java | public static String constructUrl(final HttpServerExchange exchange, final String path) {
final HeaderMap headers = exchange.getRequestHeaders();
String host = headers.getFirst(HOST);
String protocol = exchange.getConnection().getSslSessionInfo() != null ? "https" : "http";
return protocol + "://" + host + path;
} | [
"public",
"static",
"String",
"constructUrl",
"(",
"final",
"HttpServerExchange",
"exchange",
",",
"final",
"String",
"path",
")",
"{",
"final",
"HeaderMap",
"headers",
"=",
"exchange",
".",
"getRequestHeaders",
"(",
")",
";",
"String",
"host",
"=",
"headers",
... | Based on the current request represented by the HttpExchange construct a complete URL for the supplied path.
@param exchange - The current HttpExchange
@param path - The path to include in the constructed URL
@return The constructed URL | [
"Based",
"on",
"the",
"current",
"request",
"represented",
"by",
"the",
"HttpExchange",
"construct",
"a",
"complete",
"URL",
"for",
"the",
"supplied",
"path",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/DomainUtil.java#L205-L211 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/PathElement.java | PathElement.matches | public boolean matches(Property property) {
return property.getName().equals(key) && (value == WILDCARD_VALUE || property.getValue().asString().equals(value));
} | java | public boolean matches(Property property) {
return property.getName().equals(key) && (value == WILDCARD_VALUE || property.getValue().asString().equals(value));
} | [
"public",
"boolean",
"matches",
"(",
"Property",
"property",
")",
"{",
"return",
"property",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"key",
")",
"&&",
"(",
"value",
"==",
"WILDCARD_VALUE",
"||",
"property",
".",
"getValue",
"(",
")",
".",
"asString... | Determine whether the given property matches this element.
A property matches this element when property name and this key are equal,
values are equal or this element value is a wildcard.
@param property the property to check
@return {@code true} if the property matches | [
"Determine",
"whether",
"the",
"given",
"property",
"matches",
"this",
"element",
".",
"A",
"property",
"matches",
"this",
"element",
"when",
"property",
"name",
"and",
"this",
"key",
"are",
"equal",
"values",
"are",
"equal",
"or",
"this",
"element",
"value",
... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathElement.java#L177-L179 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/PathElement.java | PathElement.matches | public boolean matches(PathElement pe) {
return pe.key.equals(key) && (isWildcard() || pe.value.equals(value));
} | java | public boolean matches(PathElement pe) {
return pe.key.equals(key) && (isWildcard() || pe.value.equals(value));
} | [
"public",
"boolean",
"matches",
"(",
"PathElement",
"pe",
")",
"{",
"return",
"pe",
".",
"key",
".",
"equals",
"(",
"key",
")",
"&&",
"(",
"isWildcard",
"(",
")",
"||",
"pe",
".",
"value",
".",
"equals",
"(",
"value",
")",
")",
";",
"}"
] | Determine whether the given element matches this element.
An element matches this element when keys are equal, values are equal
or this element value is a wildcard.
@param pe the element to check
@return {@code true} if the element matches | [
"Determine",
"whether",
"the",
"given",
"element",
"matches",
"this",
"element",
".",
"An",
"element",
"matches",
"this",
"element",
"when",
"keys",
"are",
"equal",
"values",
"are",
"equal",
"or",
"this",
"element",
"value",
"is",
"a",
"wildcard",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathElement.java#L188-L190 | train |
wildfly/wildfly-core | logging/src/main/java/org/jboss/as/logging/logmanager/Log4jAppenderHandler.java | Log4jAppenderHandler.setAppender | public void setAppender(final Appender appender) {
if (this.appender != null) {
close();
}
checkAccess(this);
if (applyLayout && appender != null) {
final Formatter formatter = getFormatter();
appender.setLayout(formatter == null ? null : new FormatterLayout(formatter));
}
appenderUpdater.set(this, appender);
} | java | public void setAppender(final Appender appender) {
if (this.appender != null) {
close();
}
checkAccess(this);
if (applyLayout && appender != null) {
final Formatter formatter = getFormatter();
appender.setLayout(formatter == null ? null : new FormatterLayout(formatter));
}
appenderUpdater.set(this, appender);
} | [
"public",
"void",
"setAppender",
"(",
"final",
"Appender",
"appender",
")",
"{",
"if",
"(",
"this",
".",
"appender",
"!=",
"null",
")",
"{",
"close",
"(",
")",
";",
"}",
"checkAccess",
"(",
"this",
")",
";",
"if",
"(",
"applyLayout",
"&&",
"appender",
... | Set the Log4j appender.
@param appender the log4j appender | [
"Set",
"the",
"Log4j",
"appender",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/logmanager/Log4jAppenderHandler.java#L114-L124 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java | AbstractInstallationReporter.createOSNode | private ModelNode createOSNode() throws OperationFailedException {
String osName = getProperty("os.name");
final ModelNode os = new ModelNode();
if (osName != null && osName.toLowerCase().contains("linux")) {
try {
os.set(GnuLinuxDistribution.discover());
} catch (IOException ex) {
throw new OperationFailedException(ex);
}
} else {
os.set(osName);
}
return os;
} | java | private ModelNode createOSNode() throws OperationFailedException {
String osName = getProperty("os.name");
final ModelNode os = new ModelNode();
if (osName != null && osName.toLowerCase().contains("linux")) {
try {
os.set(GnuLinuxDistribution.discover());
} catch (IOException ex) {
throw new OperationFailedException(ex);
}
} else {
os.set(osName);
}
return os;
} | [
"private",
"ModelNode",
"createOSNode",
"(",
")",
"throws",
"OperationFailedException",
"{",
"String",
"osName",
"=",
"getProperty",
"(",
"\"os.name\"",
")",
";",
"final",
"ModelNode",
"os",
"=",
"new",
"ModelNode",
"(",
")",
";",
"if",
"(",
"osName",
"!=",
... | Create a ModelNode representing the operating system the instance is running on.
@return a ModelNode representing the operating system the instance is running on.
@throws OperationFailedException | [
"Create",
"a",
"ModelNode",
"representing",
"the",
"operating",
"system",
"the",
"instance",
"is",
"running",
"on",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L87-L100 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java | AbstractInstallationReporter.createJVMNode | private ModelNode createJVMNode() throws OperationFailedException {
ModelNode jvm = new ModelNode().setEmptyObject();
jvm.get(NAME).set(getProperty("java.vm.name"));
jvm.get(JAVA_VERSION).set(getProperty("java.vm.specification.version"));
jvm.get(JVM_VERSION).set(getProperty("java.version"));
jvm.get(JVM_VENDOR).set(getProperty("java.vm.vendor"));
jvm.get(JVM_HOME).set(getProperty("java.home"));
return jvm;
} | java | private ModelNode createJVMNode() throws OperationFailedException {
ModelNode jvm = new ModelNode().setEmptyObject();
jvm.get(NAME).set(getProperty("java.vm.name"));
jvm.get(JAVA_VERSION).set(getProperty("java.vm.specification.version"));
jvm.get(JVM_VERSION).set(getProperty("java.version"));
jvm.get(JVM_VENDOR).set(getProperty("java.vm.vendor"));
jvm.get(JVM_HOME).set(getProperty("java.home"));
return jvm;
} | [
"private",
"ModelNode",
"createJVMNode",
"(",
")",
"throws",
"OperationFailedException",
"{",
"ModelNode",
"jvm",
"=",
"new",
"ModelNode",
"(",
")",
".",
"setEmptyObject",
"(",
")",
";",
"jvm",
".",
"get",
"(",
"NAME",
")",
".",
"set",
"(",
"getProperty",
... | Create a ModelNode representing the JVM the instance is running on.
@return a ModelNode representing the JVM the instance is running on.
@throws OperationFailedException | [
"Create",
"a",
"ModelNode",
"representing",
"the",
"JVM",
"the",
"instance",
"is",
"running",
"on",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L108-L116 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java | AbstractInstallationReporter.createCPUNode | private ModelNode createCPUNode() throws OperationFailedException {
ModelNode cpu = new ModelNode().setEmptyObject();
cpu.get(ARCH).set(getProperty("os.arch"));
cpu.get(AVAILABLE_PROCESSORS).set(ProcessorInfo.availableProcessors());
return cpu;
} | java | private ModelNode createCPUNode() throws OperationFailedException {
ModelNode cpu = new ModelNode().setEmptyObject();
cpu.get(ARCH).set(getProperty("os.arch"));
cpu.get(AVAILABLE_PROCESSORS).set(ProcessorInfo.availableProcessors());
return cpu;
} | [
"private",
"ModelNode",
"createCPUNode",
"(",
")",
"throws",
"OperationFailedException",
"{",
"ModelNode",
"cpu",
"=",
"new",
"ModelNode",
"(",
")",
".",
"setEmptyObject",
"(",
")",
";",
"cpu",
".",
"get",
"(",
"ARCH",
")",
".",
"set",
"(",
"getProperty",
... | Create a ModelNode representing the CPU the instance is running on.
@return a ModelNode representing the CPU the instance is running on.
@throws OperationFailedException | [
"Create",
"a",
"ModelNode",
"representing",
"the",
"CPU",
"the",
"instance",
"is",
"running",
"on",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L124-L129 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java | AbstractInstallationReporter.getProperty | private String getProperty(String name) {
return System.getSecurityManager() == null ? System.getProperty(name) : doPrivileged(new ReadPropertyAction(name));
} | java | private String getProperty(String name) {
return System.getSecurityManager() == null ? System.getProperty(name) : doPrivileged(new ReadPropertyAction(name));
} | [
"private",
"String",
"getProperty",
"(",
"String",
"name",
")",
"{",
"return",
"System",
".",
"getSecurityManager",
"(",
")",
"==",
"null",
"?",
"System",
".",
"getProperty",
"(",
"name",
")",
":",
"doPrivileged",
"(",
"new",
"ReadPropertyAction",
"(",
"name... | Get a System property by its name.
@param name the name of the wanted System property.
@return the System property value - null if it is not defined. | [
"Get",
"a",
"System",
"property",
"by",
"its",
"name",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/operations/AbstractInstallationReporter.java#L201-L203 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java | ManagementModelNode.explore | public void explore() {
if (isLeaf) return;
if (isGeneric) return;
removeAllChildren();
try {
String addressPath = addressPath();
ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description");
resourceDesc = resourceDesc.get("result");
ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)");
ModelNode result = response.get("result");
if (!result.isDefined()) return;
List<String> childrenTypes = getChildrenTypes(addressPath);
for (ModelNode node : result.asList()) {
Property prop = node.asProperty();
if (childrenTypes.contains(prop.getName())) { // resource node
if (hasGenericOperations(addressPath, prop.getName())) {
add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName())));
}
if (prop.getValue().isDefined()) {
for (ModelNode innerNode : prop.getValue().asList()) {
UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} else { // attribute node
UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} catch (Exception e) {
e.printStackTrace();
}
} | java | public void explore() {
if (isLeaf) return;
if (isGeneric) return;
removeAllChildren();
try {
String addressPath = addressPath();
ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description");
resourceDesc = resourceDesc.get("result");
ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)");
ModelNode result = response.get("result");
if (!result.isDefined()) return;
List<String> childrenTypes = getChildrenTypes(addressPath);
for (ModelNode node : result.asList()) {
Property prop = node.asProperty();
if (childrenTypes.contains(prop.getName())) { // resource node
if (hasGenericOperations(addressPath, prop.getName())) {
add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName())));
}
if (prop.getValue().isDefined()) {
for (ModelNode innerNode : prop.getValue().asList()) {
UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} else { // attribute node
UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} catch (Exception e) {
e.printStackTrace();
}
} | [
"public",
"void",
"explore",
"(",
")",
"{",
"if",
"(",
"isLeaf",
")",
"return",
";",
"if",
"(",
"isGeneric",
")",
"return",
";",
"removeAllChildren",
"(",
")",
";",
"try",
"{",
"String",
"addressPath",
"=",
"addressPath",
"(",
")",
";",
"ModelNode",
"r... | Refresh children using read-resource operation. | [
"Refresh",
"children",
"using",
"read",
"-",
"resource",
"operation",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java#L73-L107 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java | ManagementModelNode.addressPath | public String addressPath() {
if (isLeaf) {
ManagementModelNode parent = (ManagementModelNode)getParent();
return parent.addressPath();
}
StringBuilder builder = new StringBuilder();
for (Object pathElement : getUserObjectPath()) {
UserObject userObj = (UserObject)pathElement;
if (userObj.isRoot()) { // don't want to escape root
builder.append(userObj.getName());
continue;
}
builder.append(userObj.getName());
builder.append("=");
builder.append(userObj.getEscapedValue());
builder.append("/");
}
return builder.toString();
} | java | public String addressPath() {
if (isLeaf) {
ManagementModelNode parent = (ManagementModelNode)getParent();
return parent.addressPath();
}
StringBuilder builder = new StringBuilder();
for (Object pathElement : getUserObjectPath()) {
UserObject userObj = (UserObject)pathElement;
if (userObj.isRoot()) { // don't want to escape root
builder.append(userObj.getName());
continue;
}
builder.append(userObj.getName());
builder.append("=");
builder.append(userObj.getEscapedValue());
builder.append("/");
}
return builder.toString();
} | [
"public",
"String",
"addressPath",
"(",
")",
"{",
"if",
"(",
"isLeaf",
")",
"{",
"ManagementModelNode",
"parent",
"=",
"(",
"ManagementModelNode",
")",
"getParent",
"(",
")",
";",
"return",
"parent",
".",
"addressPath",
"(",
")",
";",
"}",
"StringBuilder",
... | Get the DMR path for this node. For leaves, the DMR path is the path of its parent.
@return The DMR path for this node. | [
"Get",
"the",
"DMR",
"path",
"for",
"this",
"node",
".",
"For",
"leaves",
"the",
"DMR",
"path",
"is",
"the",
"path",
"of",
"its",
"parent",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/ManagementModelNode.java#L133-L154 | train |
wildfly/wildfly-core | network/src/main/java/org/jboss/as/network/NetworkUtils.java | NetworkUtils.mayBeIPv6Address | private static boolean mayBeIPv6Address(String input) {
if (input == null) {
return false;
}
boolean result = false;
int colonsCounter = 0;
int length = input.length();
for (int i = 0; i < length; i++) {
char c = input.charAt(i);
if (c == '.' || c == '%') {
// IPv4 in IPv6 or Zone ID detected, end of checking.
break;
}
if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')
|| (c >= 'A' && c <= 'F') || c == ':')) {
return false;
} else if (c == ':') {
colonsCounter++;
}
}
if (colonsCounter >= 2) {
result = true;
}
return result;
} | java | private static boolean mayBeIPv6Address(String input) {
if (input == null) {
return false;
}
boolean result = false;
int colonsCounter = 0;
int length = input.length();
for (int i = 0; i < length; i++) {
char c = input.charAt(i);
if (c == '.' || c == '%') {
// IPv4 in IPv6 or Zone ID detected, end of checking.
break;
}
if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')
|| (c >= 'A' && c <= 'F') || c == ':')) {
return false;
} else if (c == ':') {
colonsCounter++;
}
}
if (colonsCounter >= 2) {
result = true;
}
return result;
} | [
"private",
"static",
"boolean",
"mayBeIPv6Address",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"result",
"=",
"false",
";",
"int",
"colonsCounter",
"=",
"0",
";",
"int",
"length",... | Heuristic check if string might be an IPv6 address.
@param input Any string or null
@return true, if input string contains only hex digits and at least two colons, before '.' or '%' character. | [
"Heuristic",
"check",
"if",
"string",
"might",
"be",
"an",
"IPv6",
"address",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/network/src/main/java/org/jboss/as/network/NetworkUtils.java#L253-L278 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/transformers/DomainTransformers.java | DomainTransformers.initializeDomainRegistry | public static void initializeDomainRegistry(final TransformerRegistry registry) {
//The chains for transforming will be as follows
//For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0
registerRootTransformers(registry);
registerChainedManagementTransformers(registry);
registerChainedServerGroupTransformers(registry);
registerProfileTransformers(registry);
registerSocketBindingGroupTransformers(registry);
registerDeploymentTransformers(registry);
} | java | public static void initializeDomainRegistry(final TransformerRegistry registry) {
//The chains for transforming will be as follows
//For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0
registerRootTransformers(registry);
registerChainedManagementTransformers(registry);
registerChainedServerGroupTransformers(registry);
registerProfileTransformers(registry);
registerSocketBindingGroupTransformers(registry);
registerDeploymentTransformers(registry);
} | [
"public",
"static",
"void",
"initializeDomainRegistry",
"(",
"final",
"TransformerRegistry",
"registry",
")",
"{",
"//The chains for transforming will be as follows",
"//For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0",
"registerRootTransformers",
"(",
"registr... | Initialize the domain registry.
@param registry the domain registry | [
"Initialize",
"the",
"domain",
"registry",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/transformers/DomainTransformers.java#L77-L88 | train |
wildfly/wildfly-core | process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java | ProcessUtils.killProcess | static boolean killProcess(final String processName, int id) {
int pid;
try {
pid = processUtils.resolveProcessId(processName, id);
if(pid > 0) {
try {
Runtime.getRuntime().exec(processUtils.getKillCommand(pid));
return true;
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to kill process '%s' with pid '%s'", processName, pid);
}
}
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to resolve pid of process '%s'", processName);
}
return false;
} | java | static boolean killProcess(final String processName, int id) {
int pid;
try {
pid = processUtils.resolveProcessId(processName, id);
if(pid > 0) {
try {
Runtime.getRuntime().exec(processUtils.getKillCommand(pid));
return true;
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to kill process '%s' with pid '%s'", processName, pid);
}
}
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to resolve pid of process '%s'", processName);
}
return false;
} | [
"static",
"boolean",
"killProcess",
"(",
"final",
"String",
"processName",
",",
"int",
"id",
")",
"{",
"int",
"pid",
";",
"try",
"{",
"pid",
"=",
"processUtils",
".",
"resolveProcessId",
"(",
"processName",
",",
"id",
")",
";",
"if",
"(",
"pid",
">",
"... | Try to kill a given process.
@param processName the process name
@param id the process integer id, or {@code -1} if this is not relevant
@return {@code true} if the command succeeded, {@code false} otherwise | [
"Try",
"to",
"kill",
"a",
"given",
"process",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java#L38-L54 | train |
wildfly/wildfly-core | launcher/src/main/java/org/wildfly/core/launcher/Launcher.java | Launcher.addEnvironmentVariable | public Launcher addEnvironmentVariable(final String key, final String value) {
env.put(key, value);
return this;
} | java | public Launcher addEnvironmentVariable(final String key, final String value) {
env.put(key, value);
return this;
} | [
"public",
"Launcher",
"addEnvironmentVariable",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"env",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds an environment variable to the process being created.
@param key they key for the variable
@param value the value for the variable
@return the launcher | [
"Adds",
"an",
"environment",
"variable",
"to",
"the",
"process",
"being",
"created",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Launcher.java#L218-L221 | train |
wildfly/wildfly-core | remoting/subsystem/src/main/java/org/jboss/as/remoting/RemotingTransformers.java | RemotingTransformers.buildTransformers_3_0 | private void buildTransformers_3_0(ResourceTransformationDescriptionBuilder builder) {
/*
====== Resource root address: ["subsystem" => "remoting"] - Current version: 4.0.0; legacy version: 3.0.0 =======
--- Problems for relative address to root ["configuration" => "endpoint"]:
Different 'default' for attribute 'sasl-protocol'. Current: "remote"; legacy: "remoting" ## both are valid also for legacy servers
--- Problems for relative address to root ["connector" => "*"]:
Missing attributes in current: []; missing in legacy [sasl-authentication-factory, ssl-context]
Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory, ssl-context]
--- Problems for relative address to root ["http-connector" => "*"]:
Missing attributes in current: []; missing in legacy [sasl-authentication-factory]
Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory]
--- Problems for relative address to root ["remote-outbound-connection" => "*"]:
Missing attributes in current: []; missing in legacy [authentication-context]
Different 'alternatives' for attribute 'protocol'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for attribute 'security-realm'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for attribute 'username'. Current: ["authentication-context"]; legacy: undefined
Missing parameters for operation 'add' in current: []; missing in legacy [authentication-context]
Different 'alternatives' for parameter 'protocol' of operation 'add'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for parameter 'security-realm' of operation 'add'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for parameter 'username' of operation 'add'. Current: ["authentication-context"]; legacy: undefined
*/
builder.addChildResource(ConnectorResource.PATH).getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.UNDEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY, ConnectorResource.SSL_CONTEXT)
.addRejectCheck(RejectAttributeChecker.DEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY, ConnectorResource.SSL_CONTEXT);
builder.addChildResource(RemotingEndpointResource.ENDPOINT_PATH).getAttributeBuilder()
.setValueConverter(new AttributeConverter.DefaultAttributeConverter() {
@Override
protected void convertAttribute(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) {
if (!attributeValue.isDefined()) {
attributeValue.set("remoting"); //if value is not defined, set it to EAP 7.0 default valueRemotingSubsystemTransformersTestCase
}
}
}, RemotingSubsystemRootResource.SASL_PROTOCOL);
builder.addChildResource(HttpConnectorResource.PATH).getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.UNDEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY)
.addRejectCheck(RejectAttributeChecker.DEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY);
builder.addChildResource(RemoteOutboundConnectionResourceDefinition.ADDRESS).getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.UNDEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY)
.addRejectCheck(RejectAttributeChecker.DEFINED, RemoteOutboundConnectionResourceDefinition.AUTHENTICATION_CONTEXT);
} | java | private void buildTransformers_3_0(ResourceTransformationDescriptionBuilder builder) {
/*
====== Resource root address: ["subsystem" => "remoting"] - Current version: 4.0.0; legacy version: 3.0.0 =======
--- Problems for relative address to root ["configuration" => "endpoint"]:
Different 'default' for attribute 'sasl-protocol'. Current: "remote"; legacy: "remoting" ## both are valid also for legacy servers
--- Problems for relative address to root ["connector" => "*"]:
Missing attributes in current: []; missing in legacy [sasl-authentication-factory, ssl-context]
Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory, ssl-context]
--- Problems for relative address to root ["http-connector" => "*"]:
Missing attributes in current: []; missing in legacy [sasl-authentication-factory]
Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory]
--- Problems for relative address to root ["remote-outbound-connection" => "*"]:
Missing attributes in current: []; missing in legacy [authentication-context]
Different 'alternatives' for attribute 'protocol'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for attribute 'security-realm'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for attribute 'username'. Current: ["authentication-context"]; legacy: undefined
Missing parameters for operation 'add' in current: []; missing in legacy [authentication-context]
Different 'alternatives' for parameter 'protocol' of operation 'add'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for parameter 'security-realm' of operation 'add'. Current: ["authentication-context"]; legacy: undefined
Different 'alternatives' for parameter 'username' of operation 'add'. Current: ["authentication-context"]; legacy: undefined
*/
builder.addChildResource(ConnectorResource.PATH).getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.UNDEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY, ConnectorResource.SSL_CONTEXT)
.addRejectCheck(RejectAttributeChecker.DEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY, ConnectorResource.SSL_CONTEXT);
builder.addChildResource(RemotingEndpointResource.ENDPOINT_PATH).getAttributeBuilder()
.setValueConverter(new AttributeConverter.DefaultAttributeConverter() {
@Override
protected void convertAttribute(PathAddress address, String attributeName, ModelNode attributeValue, TransformationContext context) {
if (!attributeValue.isDefined()) {
attributeValue.set("remoting"); //if value is not defined, set it to EAP 7.0 default valueRemotingSubsystemTransformersTestCase
}
}
}, RemotingSubsystemRootResource.SASL_PROTOCOL);
builder.addChildResource(HttpConnectorResource.PATH).getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.UNDEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY)
.addRejectCheck(RejectAttributeChecker.DEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY);
builder.addChildResource(RemoteOutboundConnectionResourceDefinition.ADDRESS).getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.UNDEFINED, ConnectorCommon.SASL_AUTHENTICATION_FACTORY)
.addRejectCheck(RejectAttributeChecker.DEFINED, RemoteOutboundConnectionResourceDefinition.AUTHENTICATION_CONTEXT);
} | [
"private",
"void",
"buildTransformers_3_0",
"(",
"ResourceTransformationDescriptionBuilder",
"builder",
")",
"{",
"/*\n ====== Resource root address: [\"subsystem\" => \"remoting\"] - Current version: 4.0.0; legacy version: 3.0.0 =======\n --- Problems for relative address to root [\"c... | EAP 7.0 | [
"EAP",
"7",
".",
"0"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/RemotingTransformers.java#L118-L161 | train |
wildfly/wildfly-core | remoting/subsystem/src/main/java/org/jboss/as/remoting/RemotingTransformers.java | RemotingTransformers.buildTransformers_4_0 | private void buildTransformers_4_0(ResourceTransformationDescriptionBuilder builder) {
// We need to do custom transformation of the attribute in the root resource
// related to endpoint configs, as these were moved to the root from a previous child resource
EndPointWriteTransformer endPointWriteTransformer = new EndPointWriteTransformer();
builder.getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.ALWAYS, endpointAttrArray)
.end()
.addOperationTransformationOverride("add")
//.inheritResourceAttributeDefinitions() // don't inherit as we discard
.setCustomOperationTransformer(new EndPointAddTransformer())
.end()
.addOperationTransformationOverride("write-attribute")
//.inheritResourceAttributeDefinitions() // don't inherit as we discard
.setCustomOperationTransformer(endPointWriteTransformer)
.end()
.addOperationTransformationOverride("undefine-attribute")
//.inheritResourceAttributeDefinitions() // don't inherit as we discard
.setCustomOperationTransformer(endPointWriteTransformer)
.end();
} | java | private void buildTransformers_4_0(ResourceTransformationDescriptionBuilder builder) {
// We need to do custom transformation of the attribute in the root resource
// related to endpoint configs, as these were moved to the root from a previous child resource
EndPointWriteTransformer endPointWriteTransformer = new EndPointWriteTransformer();
builder.getAttributeBuilder()
.setDiscard(DiscardAttributeChecker.ALWAYS, endpointAttrArray)
.end()
.addOperationTransformationOverride("add")
//.inheritResourceAttributeDefinitions() // don't inherit as we discard
.setCustomOperationTransformer(new EndPointAddTransformer())
.end()
.addOperationTransformationOverride("write-attribute")
//.inheritResourceAttributeDefinitions() // don't inherit as we discard
.setCustomOperationTransformer(endPointWriteTransformer)
.end()
.addOperationTransformationOverride("undefine-attribute")
//.inheritResourceAttributeDefinitions() // don't inherit as we discard
.setCustomOperationTransformer(endPointWriteTransformer)
.end();
} | [
"private",
"void",
"buildTransformers_4_0",
"(",
"ResourceTransformationDescriptionBuilder",
"builder",
")",
"{",
"// We need to do custom transformation of the attribute in the root resource",
"// related to endpoint configs, as these were moved to the root from a previous child resource",
"End... | EAP 7.1 | [
"EAP",
"7",
".",
"1"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/RemotingTransformers.java#L164-L184 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.getState | ServerStatus getState() {
final InternalState requiredState = this.requiredState;
final InternalState state = internalState;
if(requiredState == InternalState.FAILED) {
return ServerStatus.FAILED;
}
switch (state) {
case STOPPED:
return ServerStatus.STOPPED;
case SERVER_STARTED:
return ServerStatus.STARTED;
default: {
if(requiredState == InternalState.SERVER_STARTED) {
return ServerStatus.STARTING;
} else {
return ServerStatus.STOPPING;
}
}
}
} | java | ServerStatus getState() {
final InternalState requiredState = this.requiredState;
final InternalState state = internalState;
if(requiredState == InternalState.FAILED) {
return ServerStatus.FAILED;
}
switch (state) {
case STOPPED:
return ServerStatus.STOPPED;
case SERVER_STARTED:
return ServerStatus.STARTED;
default: {
if(requiredState == InternalState.SERVER_STARTED) {
return ServerStatus.STARTING;
} else {
return ServerStatus.STOPPING;
}
}
}
} | [
"ServerStatus",
"getState",
"(",
")",
"{",
"final",
"InternalState",
"requiredState",
"=",
"this",
".",
"requiredState",
";",
"final",
"InternalState",
"state",
"=",
"internalState",
";",
"if",
"(",
"requiredState",
"==",
"InternalState",
".",
"FAILED",
")",
"{"... | Determine the current state the server is in.
@return the server status | [
"Determine",
"the",
"current",
"state",
"the",
"server",
"is",
"in",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L200-L219 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.reload | synchronized boolean reload(int permit, boolean suspend) {
return internalSetState(new ReloadTask(permit, suspend), InternalState.SERVER_STARTED, InternalState.RELOADING);
} | java | synchronized boolean reload(int permit, boolean suspend) {
return internalSetState(new ReloadTask(permit, suspend), InternalState.SERVER_STARTED, InternalState.RELOADING);
} | [
"synchronized",
"boolean",
"reload",
"(",
"int",
"permit",
",",
"boolean",
"suspend",
")",
"{",
"return",
"internalSetState",
"(",
"new",
"ReloadTask",
"(",
"permit",
",",
"suspend",
")",
",",
"InternalState",
".",
"SERVER_STARTED",
",",
"InternalState",
".",
... | Reload a managed server.
@param permit the controller permit
@return whether the state was changed successfully or not | [
"Reload",
"a",
"managed",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L238-L240 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.start | synchronized void start(final ManagedServerBootCmdFactory factory) {
final InternalState required = this.requiredState;
// Ignore if the server is already started
if(required == InternalState.SERVER_STARTED) {
return;
}
// In case the server failed to start, try to start it again
if(required != InternalState.FAILED) {
final InternalState current = this.internalState;
if(current != required) {
// TODO this perhaps should wait?
throw new IllegalStateException();
}
}
operationID = CurrentOperationIdHolder.getCurrentOperationID();
bootConfiguration = factory.createConfiguration();
requiredState = InternalState.SERVER_STARTED;
ROOT_LOGGER.startingServer(serverName);
transition();
} | java | synchronized void start(final ManagedServerBootCmdFactory factory) {
final InternalState required = this.requiredState;
// Ignore if the server is already started
if(required == InternalState.SERVER_STARTED) {
return;
}
// In case the server failed to start, try to start it again
if(required != InternalState.FAILED) {
final InternalState current = this.internalState;
if(current != required) {
// TODO this perhaps should wait?
throw new IllegalStateException();
}
}
operationID = CurrentOperationIdHolder.getCurrentOperationID();
bootConfiguration = factory.createConfiguration();
requiredState = InternalState.SERVER_STARTED;
ROOT_LOGGER.startingServer(serverName);
transition();
} | [
"synchronized",
"void",
"start",
"(",
"final",
"ManagedServerBootCmdFactory",
"factory",
")",
"{",
"final",
"InternalState",
"required",
"=",
"this",
".",
"requiredState",
";",
"// Ignore if the server is already started",
"if",
"(",
"required",
"==",
"InternalState",
"... | Start a managed server.
@param factory the boot command factory | [
"Start",
"a",
"managed",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L247-L266 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.stop | synchronized void stop(Integer timeout) {
final InternalState required = this.requiredState;
if(required != InternalState.STOPPED) {
this.requiredState = InternalState.STOPPED;
ROOT_LOGGER.stoppingServer(serverName);
// Only send the stop operation if the server is started
if (internalState == InternalState.SERVER_STARTED) {
internalSetState(new ServerStopTask(timeout), internalState, InternalState.PROCESS_STOPPING);
} else {
transition(false);
}
}
} | java | synchronized void stop(Integer timeout) {
final InternalState required = this.requiredState;
if(required != InternalState.STOPPED) {
this.requiredState = InternalState.STOPPED;
ROOT_LOGGER.stoppingServer(serverName);
// Only send the stop operation if the server is started
if (internalState == InternalState.SERVER_STARTED) {
internalSetState(new ServerStopTask(timeout), internalState, InternalState.PROCESS_STOPPING);
} else {
transition(false);
}
}
} | [
"synchronized",
"void",
"stop",
"(",
"Integer",
"timeout",
")",
"{",
"final",
"InternalState",
"required",
"=",
"this",
".",
"requiredState",
";",
"if",
"(",
"required",
"!=",
"InternalState",
".",
"STOPPED",
")",
"{",
"this",
".",
"requiredState",
"=",
"Int... | Stop a managed server. | [
"Stop",
"a",
"managed",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L271-L283 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.reconnectServerProcess | synchronized void reconnectServerProcess(final ManagedServerBootCmdFactory factory) {
if(this.requiredState != InternalState.SERVER_STARTED) {
this.bootConfiguration = factory;
this.requiredState = InternalState.SERVER_STARTED;
ROOT_LOGGER.reconnectingServer(serverName);
internalSetState(new ReconnectTask(), InternalState.STOPPED, InternalState.SEND_STDIN);
}
} | java | synchronized void reconnectServerProcess(final ManagedServerBootCmdFactory factory) {
if(this.requiredState != InternalState.SERVER_STARTED) {
this.bootConfiguration = factory;
this.requiredState = InternalState.SERVER_STARTED;
ROOT_LOGGER.reconnectingServer(serverName);
internalSetState(new ReconnectTask(), InternalState.STOPPED, InternalState.SEND_STDIN);
}
} | [
"synchronized",
"void",
"reconnectServerProcess",
"(",
"final",
"ManagedServerBootCmdFactory",
"factory",
")",
"{",
"if",
"(",
"this",
".",
"requiredState",
"!=",
"InternalState",
".",
"SERVER_STARTED",
")",
"{",
"this",
".",
"bootConfiguration",
"=",
"factory",
";"... | Try to reconnect to a started server. | [
"Try",
"to",
"reconnect",
"to",
"a",
"started",
"server",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L334-L341 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.removeServerProcess | synchronized void removeServerProcess() {
this.requiredState = InternalState.STOPPED;
internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);
} | java | synchronized void removeServerProcess() {
this.requiredState = InternalState.STOPPED;
internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);
} | [
"synchronized",
"void",
"removeServerProcess",
"(",
")",
"{",
"this",
".",
"requiredState",
"=",
"InternalState",
".",
"STOPPED",
";",
"internalSetState",
"(",
"new",
"ProcessRemoveTask",
"(",
")",
",",
"InternalState",
".",
"STOPPED",
",",
"InternalState",
".",
... | On host controller reload, remove a not running server registered in the process controller declared as down. | [
"On",
"host",
"controller",
"reload",
"remove",
"a",
"not",
"running",
"server",
"registered",
"in",
"the",
"process",
"controller",
"declared",
"as",
"down",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L346-L349 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.setServerProcessStopping | synchronized void setServerProcessStopping() {
this.requiredState = InternalState.STOPPED;
internalSetState(null, InternalState.STOPPED, InternalState.PROCESS_STOPPING);
} | java | synchronized void setServerProcessStopping() {
this.requiredState = InternalState.STOPPED;
internalSetState(null, InternalState.STOPPED, InternalState.PROCESS_STOPPING);
} | [
"synchronized",
"void",
"setServerProcessStopping",
"(",
")",
"{",
"this",
".",
"requiredState",
"=",
"InternalState",
".",
"STOPPED",
";",
"internalSetState",
"(",
"null",
",",
"InternalState",
".",
"STOPPED",
",",
"InternalState",
".",
"PROCESS_STOPPING",
")",
"... | On host controller reload, remove a not running server registered in the process controller declared as stopping. | [
"On",
"host",
"controller",
"reload",
"remove",
"a",
"not",
"running",
"server",
"registered",
"in",
"the",
"process",
"controller",
"declared",
"as",
"stopping",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L354-L357 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.awaitState | boolean awaitState(final InternalState expected) {
synchronized (this) {
final InternalState initialRequired = this.requiredState;
for(;;) {
final InternalState required = this.requiredState;
// Stop in case the server failed to reach the state
if(required == InternalState.FAILED) {
return false;
// Stop in case the required state changed
} else if (initialRequired != required) {
return false;
}
final InternalState current = this.internalState;
if(expected == current) {
return true;
}
try {
wait();
} catch(InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
}
}
} | java | boolean awaitState(final InternalState expected) {
synchronized (this) {
final InternalState initialRequired = this.requiredState;
for(;;) {
final InternalState required = this.requiredState;
// Stop in case the server failed to reach the state
if(required == InternalState.FAILED) {
return false;
// Stop in case the required state changed
} else if (initialRequired != required) {
return false;
}
final InternalState current = this.internalState;
if(expected == current) {
return true;
}
try {
wait();
} catch(InterruptedException e) {
Thread.currentThread().interrupt();
return false;
}
}
}
} | [
"boolean",
"awaitState",
"(",
"final",
"InternalState",
"expected",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"final",
"InternalState",
"initialRequired",
"=",
"this",
".",
"requiredState",
";",
"for",
"(",
";",
";",
")",
"{",
"final",
"InternalState",
... | Await a state.
@param expected the expected state
@return {@code true} if the state was reached, {@code false} otherwise | [
"Await",
"a",
"state",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L365-L389 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.processUnstable | boolean processUnstable() {
boolean change = !unstable;
if (change) { // Only once until the process is removed. A process is unstable until removed.
unstable = true;
HostControllerLogger.ROOT_LOGGER.managedServerUnstable(serverName);
}
return change;
} | java | boolean processUnstable() {
boolean change = !unstable;
if (change) { // Only once until the process is removed. A process is unstable until removed.
unstable = true;
HostControllerLogger.ROOT_LOGGER.managedServerUnstable(serverName);
}
return change;
} | [
"boolean",
"processUnstable",
"(",
")",
"{",
"boolean",
"change",
"=",
"!",
"unstable",
";",
"if",
"(",
"change",
")",
"{",
"// Only once until the process is removed. A process is unstable until removed.",
"unstable",
"=",
"true",
";",
"HostControllerLogger",
".",
"ROO... | Notification that the process has become unstable.
@return {@code true} if this is a change in status | [
"Notification",
"that",
"the",
"process",
"has",
"become",
"unstable",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L410-L417 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.callbackUnregistered | boolean callbackUnregistered(final TransactionalProtocolClient old, final boolean shuttingDown) {
// Disconnect the remote connection.
// WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't
// be informed that the channel has closed
protocolClient.disconnected(old);
synchronized (this) {
// If the connection dropped without us stopping the process ask for reconnection
if (!shuttingDown && requiredState == InternalState.SERVER_STARTED) {
final InternalState state = internalState;
if (state == InternalState.PROCESS_STOPPED
|| state == InternalState.PROCESS_STOPPING
|| state == InternalState.STOPPED) {
// In case it stopped we don't reconnect
return true;
}
// In case we are reloading, it will reconnect automatically
if (state == InternalState.RELOADING) {
return true;
}
try {
ROOT_LOGGER.logf(DEBUG_LEVEL, "trying to reconnect to %s current-state (%s) required-state (%s)", serverName, state, requiredState);
internalSetState(new ReconnectTask(), state, InternalState.SEND_STDIN);
} catch (Exception e) {
ROOT_LOGGER.logf(DEBUG_LEVEL, e, "failed to send reconnect task");
}
return false;
} else {
return true;
}
}
} | java | boolean callbackUnregistered(final TransactionalProtocolClient old, final boolean shuttingDown) {
// Disconnect the remote connection.
// WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't
// be informed that the channel has closed
protocolClient.disconnected(old);
synchronized (this) {
// If the connection dropped without us stopping the process ask for reconnection
if (!shuttingDown && requiredState == InternalState.SERVER_STARTED) {
final InternalState state = internalState;
if (state == InternalState.PROCESS_STOPPED
|| state == InternalState.PROCESS_STOPPING
|| state == InternalState.STOPPED) {
// In case it stopped we don't reconnect
return true;
}
// In case we are reloading, it will reconnect automatically
if (state == InternalState.RELOADING) {
return true;
}
try {
ROOT_LOGGER.logf(DEBUG_LEVEL, "trying to reconnect to %s current-state (%s) required-state (%s)", serverName, state, requiredState);
internalSetState(new ReconnectTask(), state, InternalState.SEND_STDIN);
} catch (Exception e) {
ROOT_LOGGER.logf(DEBUG_LEVEL, e, "failed to send reconnect task");
}
return false;
} else {
return true;
}
}
} | [
"boolean",
"callbackUnregistered",
"(",
"final",
"TransactionalProtocolClient",
"old",
",",
"final",
"boolean",
"shuttingDown",
")",
"{",
"// Disconnect the remote connection.",
"// WFCORE-196 Do this out of the sync block to avoid deadlocks where in-flight requests can't",
"// be inform... | Unregister the mgmt channel.
@param old the proxy controller to unregister
@param shuttingDown whether the server inventory is shutting down
@return whether the registration can be removed from the domain-controller | [
"Unregister",
"the",
"mgmt",
"channel",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L465-L496 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.processFinished | synchronized void processFinished() {
final InternalState required = this.requiredState;
final InternalState state = this.internalState;
// If the server was not stopped
if(required == InternalState.STOPPED && state == InternalState.PROCESS_STOPPING) {
finishTransition(InternalState.PROCESS_STOPPING, InternalState.PROCESS_STOPPED);
} else {
this.requiredState = InternalState.STOPPED;
if ( !(internalSetState(getTransitionTask(InternalState.PROCESS_STOPPING), internalState, InternalState.PROCESS_STOPPING)
&& internalSetState(getTransitionTask(InternalState.PROCESS_REMOVING), internalState, InternalState.PROCESS_REMOVING)
&& internalSetState(getTransitionTask(InternalState.STOPPED), internalState, InternalState.STOPPED)) ){
this.requiredState = InternalState.FAILED;
internalSetState(null, internalState, InternalState.PROCESS_STOPPED);
}
}
} | java | synchronized void processFinished() {
final InternalState required = this.requiredState;
final InternalState state = this.internalState;
// If the server was not stopped
if(required == InternalState.STOPPED && state == InternalState.PROCESS_STOPPING) {
finishTransition(InternalState.PROCESS_STOPPING, InternalState.PROCESS_STOPPED);
} else {
this.requiredState = InternalState.STOPPED;
if ( !(internalSetState(getTransitionTask(InternalState.PROCESS_STOPPING), internalState, InternalState.PROCESS_STOPPING)
&& internalSetState(getTransitionTask(InternalState.PROCESS_REMOVING), internalState, InternalState.PROCESS_REMOVING)
&& internalSetState(getTransitionTask(InternalState.STOPPED), internalState, InternalState.STOPPED)) ){
this.requiredState = InternalState.FAILED;
internalSetState(null, internalState, InternalState.PROCESS_STOPPED);
}
}
} | [
"synchronized",
"void",
"processFinished",
"(",
")",
"{",
"final",
"InternalState",
"required",
"=",
"this",
".",
"requiredState",
";",
"final",
"InternalState",
"state",
"=",
"this",
".",
"internalState",
";",
"// If the server was not stopped",
"if",
"(",
"require... | Notification that the server process finished. | [
"Notification",
"that",
"the",
"server",
"process",
"finished",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L501-L516 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.transitionFailed | synchronized void transitionFailed(final InternalState state) {
final InternalState current = this.internalState;
if(state == current) {
// Revert transition and mark as failed
switch (current) {
case PROCESS_ADDING:
this.internalState = InternalState.PROCESS_STOPPED;
break;
case PROCESS_STARTED:
internalSetState(getTransitionTask(InternalState.PROCESS_STOPPING), InternalState.PROCESS_STARTED, InternalState.PROCESS_ADDED);
break;
case PROCESS_STARTING:
this.internalState = InternalState.PROCESS_ADDED;
break;
case SEND_STDIN:
case SERVER_STARTING:
this.internalState = InternalState.PROCESS_STARTED;
break;
}
this.requiredState = InternalState.FAILED;
notifyAll();
}
} | java | synchronized void transitionFailed(final InternalState state) {
final InternalState current = this.internalState;
if(state == current) {
// Revert transition and mark as failed
switch (current) {
case PROCESS_ADDING:
this.internalState = InternalState.PROCESS_STOPPED;
break;
case PROCESS_STARTED:
internalSetState(getTransitionTask(InternalState.PROCESS_STOPPING), InternalState.PROCESS_STARTED, InternalState.PROCESS_ADDED);
break;
case PROCESS_STARTING:
this.internalState = InternalState.PROCESS_ADDED;
break;
case SEND_STDIN:
case SERVER_STARTING:
this.internalState = InternalState.PROCESS_STARTED;
break;
}
this.requiredState = InternalState.FAILED;
notifyAll();
}
} | [
"synchronized",
"void",
"transitionFailed",
"(",
"final",
"InternalState",
"state",
")",
"{",
"final",
"InternalState",
"current",
"=",
"this",
".",
"internalState",
";",
"if",
"(",
"state",
"==",
"current",
")",
"{",
"// Revert transition and mark as failed",
"swit... | Notification that a state transition failed.
@param state the failed transition | [
"Notification",
"that",
"a",
"state",
"transition",
"failed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L549-L571 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java | ManagedServer.finishTransition | private synchronized void finishTransition(final InternalState current, final InternalState next) {
internalSetState(getTransitionTask(next), current, next);
transition();
} | java | private synchronized void finishTransition(final InternalState current, final InternalState next) {
internalSetState(getTransitionTask(next), current, next);
transition();
} | [
"private",
"synchronized",
"void",
"finishTransition",
"(",
"final",
"InternalState",
"current",
",",
"final",
"InternalState",
"next",
")",
"{",
"internalSetState",
"(",
"getTransitionTask",
"(",
"next",
")",
",",
"current",
",",
"next",
")",
";",
"transition",
... | Finish a state transition from a notification.
@param current
@param next | [
"Finish",
"a",
"state",
"transition",
"from",
"a",
"notification",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/ManagedServer.java#L600-L603 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java | SimpleResourceDefinition.registerCapabilities | @Override
public void registerCapabilities(ManagementResourceRegistration resourceRegistration) {
if (capabilities!=null) {
for (RuntimeCapability c : capabilities) {
resourceRegistration.registerCapability(c);
}
}
if (incorporatingCapabilities != null) {
resourceRegistration.registerIncorporatingCapabilities(incorporatingCapabilities);
}
assert requirements != null;
resourceRegistration.registerRequirements(requirements);
} | java | @Override
public void registerCapabilities(ManagementResourceRegistration resourceRegistration) {
if (capabilities!=null) {
for (RuntimeCapability c : capabilities) {
resourceRegistration.registerCapability(c);
}
}
if (incorporatingCapabilities != null) {
resourceRegistration.registerIncorporatingCapabilities(incorporatingCapabilities);
}
assert requirements != null;
resourceRegistration.registerRequirements(requirements);
} | [
"@",
"Override",
"public",
"void",
"registerCapabilities",
"(",
"ManagementResourceRegistration",
"resourceRegistration",
")",
"{",
"if",
"(",
"capabilities",
"!=",
"null",
")",
"{",
"for",
"(",
"RuntimeCapability",
"c",
":",
"capabilities",
")",
"{",
"resourceRegis... | Register capabilities associated with this resource.
<p>Classes that overrides this method <em>MUST</em> call {@code super.registerCapabilities(resourceRegistration)}.</p>
@param resourceRegistration a {@link ManagementResourceRegistration} created from this definition | [
"Register",
"capabilities",
"associated",
"with",
"this",
"resource",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java#L376-L388 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java | SimpleResourceDefinition.registerAddOperation | @Deprecated
@SuppressWarnings("deprecation")
protected void registerAddOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) {
if (handler instanceof DescriptionProvider) {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
(DescriptionProvider) handler, OperationEntry.EntryType.PUBLIC,flags)
, handler);
} else {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
new DefaultResourceAddDescriptionProvider(registration, descriptionResolver, orderedChild),
OperationEntry.EntryType.PUBLIC,
flags)
, handler);
}
} | java | @Deprecated
@SuppressWarnings("deprecation")
protected void registerAddOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) {
if (handler instanceof DescriptionProvider) {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
(DescriptionProvider) handler, OperationEntry.EntryType.PUBLIC,flags)
, handler);
} else {
registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD,
new DefaultResourceAddDescriptionProvider(registration, descriptionResolver, orderedChild),
OperationEntry.EntryType.PUBLIC,
flags)
, handler);
}
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"void",
"registerAddOperation",
"(",
"final",
"ManagementResourceRegistration",
"registration",
",",
"final",
"OperationStepHandler",
"handler",
",",
"OperationEntry",
".",
"Flag",
"..."... | Registers add operation
@param registration resource on which to register
@param handler operation handler to register
@param flags with flags
@deprecated use {@link #registerAddOperation(org.jboss.as.controller.registry.ManagementResourceRegistration, AbstractAddStepHandler, org.jboss.as.controller.registry.OperationEntry.Flag...)} | [
"Registers",
"add",
"operation"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java#L415-L430 | train |
wildfly/wildfly-core | protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelReceiver.java | ManagementChannelReceiver.handlePing | private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException {
final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion());
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | java | private static void handlePing(final Channel channel, final ManagementProtocolHeader header) throws IOException {
final ManagementProtocolHeader response = new ManagementPongHeader(header.getVersion());
final MessageOutputStream output = channel.writeMessage();
try {
writeHeader(response, output);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | [
"private",
"static",
"void",
"handlePing",
"(",
"final",
"Channel",
"channel",
",",
"final",
"ManagementProtocolHeader",
"header",
")",
"throws",
"IOException",
"{",
"final",
"ManagementProtocolHeader",
"response",
"=",
"new",
"ManagementPongHeader",
"(",
"header",
".... | Handle a simple ping request.
@param channel the channel
@param header the protocol header
@throws IOException for any error | [
"Handle",
"a",
"simple",
"ping",
"request",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelReceiver.java#L142-L151 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/util/CLIExpressionResolver.java | CLIExpressionResolver.resolveOrOriginal | public static String resolveOrOriginal(String input) {
try {
return resolve(input, true);
} catch (UnresolvedExpressionException e) {
return input;
}
} | java | public static String resolveOrOriginal(String input) {
try {
return resolve(input, true);
} catch (UnresolvedExpressionException e) {
return input;
}
} | [
"public",
"static",
"String",
"resolveOrOriginal",
"(",
"String",
"input",
")",
"{",
"try",
"{",
"return",
"resolve",
"(",
"input",
",",
"true",
")",
";",
"}",
"catch",
"(",
"UnresolvedExpressionException",
"e",
")",
"{",
"return",
"input",
";",
"}",
"}"
] | Attempts to substitute all the found expressions in the input
with their corresponding resolved values.
If any of the found expressions failed to resolve or
if the input does not contain any expression, the input is returned as is.
@param input the input string
@return the input with resolved expressions or the original input in case
the input didn't contain any expressions or at least one of the
expressions could not be resolved | [
"Attempts",
"to",
"substitute",
"all",
"the",
"found",
"expressions",
"in",
"the",
"input",
"with",
"their",
"corresponding",
"resolved",
"values",
".",
"If",
"any",
"of",
"the",
"found",
"expressions",
"failed",
"to",
"resolve",
"or",
"if",
"the",
"input",
... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/util/CLIExpressionResolver.java#L79-L85 | train |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/impl/AbstractModelControllerClient.java | AbstractModelControllerClient.executeForResult | private OperationResponse executeForResult(final OperationExecutionContext executionContext) throws IOException {
try {
return execute(executionContext).get();
} catch(Exception e) {
throw new IOException(e);
}
} | java | private OperationResponse executeForResult(final OperationExecutionContext executionContext) throws IOException {
try {
return execute(executionContext).get();
} catch(Exception e) {
throw new IOException(e);
}
} | [
"private",
"OperationResponse",
"executeForResult",
"(",
"final",
"OperationExecutionContext",
"executionContext",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"execute",
"(",
"executionContext",
")",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"Exce... | Execute for result.
@param executionContext the execution context
@return the result
@throws IOException for any error | [
"Execute",
"for",
"result",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/impl/AbstractModelControllerClient.java#L145-L151 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/installation/LayersConfig.java | LayersConfig.getLayersConfig | public static LayersConfig getLayersConfig(final File repoRoot) throws IOException {
final File layersList = new File(repoRoot, LAYERS_CONF);
if (!layersList.exists()) {
return new LayersConfig();
}
final Properties properties = PatchUtils.loadProperties(layersList);
return new LayersConfig(properties);
} | java | public static LayersConfig getLayersConfig(final File repoRoot) throws IOException {
final File layersList = new File(repoRoot, LAYERS_CONF);
if (!layersList.exists()) {
return new LayersConfig();
}
final Properties properties = PatchUtils.loadProperties(layersList);
return new LayersConfig(properties);
} | [
"public",
"static",
"LayersConfig",
"getLayersConfig",
"(",
"final",
"File",
"repoRoot",
")",
"throws",
"IOException",
"{",
"final",
"File",
"layersList",
"=",
"new",
"File",
"(",
"repoRoot",
",",
"LAYERS_CONF",
")",
";",
"if",
"(",
"!",
"layersList",
".",
"... | Process the layers.conf file.
@param repoRoot the root
@return the layers conf
@throws java.io.IOException | [
"Process",
"the",
"layers",
".",
"conf",
"file",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/LayersConfig.java#L86-L93 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml_Legacy.java | HostXml_Legacy.parseRemoteDomainControllerAttributes_1_5 | private boolean parseRemoteDomainControllerAttributes_1_5(final XMLExtendedStreamReader reader, final ModelNode address,
final List<ModelNode> list, boolean allowDiscoveryOptions) throws XMLStreamException {
final ModelNode update = new ModelNode();
update.get(OP_ADDR).set(address);
update.get(OP).set(RemoteDomainControllerAddHandler.OPERATION_NAME);
// Handle attributes
AdminOnlyDomainConfigPolicy adminOnlyPolicy = AdminOnlyDomainConfigPolicy.DEFAULT;
boolean requireDiscoveryOptions = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case HOST: {
DomainControllerWriteAttributeHandler.HOST.parseAndSetParameter(value, update, reader);
break;
}
case PORT: {
DomainControllerWriteAttributeHandler.PORT.parseAndSetParameter(value, update, reader);
break;
}
case SECURITY_REALM: {
DomainControllerWriteAttributeHandler.SECURITY_REALM.parseAndSetParameter(value, update, reader);
break;
}
case USERNAME: {
DomainControllerWriteAttributeHandler.USERNAME.parseAndSetParameter(value, update, reader);
break;
}
case ADMIN_ONLY_POLICY: {
DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.parseAndSetParameter(value, update, reader);
ModelNode nodeValue = update.get(DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.getName());
if (nodeValue.getType() != ModelType.EXPRESSION) {
adminOnlyPolicy = AdminOnlyDomainConfigPolicy.getPolicy(nodeValue.asString());
}
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
}
if (!update.hasDefined(DomainControllerWriteAttributeHandler.HOST.getName())) {
if (allowDiscoveryOptions) {
requireDiscoveryOptions = isRequireDiscoveryOptions(adminOnlyPolicy);
} else {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.HOST.getLocalName()));
}
}
if (!update.hasDefined(DomainControllerWriteAttributeHandler.PORT.getName())) {
if (allowDiscoveryOptions) {
requireDiscoveryOptions = requireDiscoveryOptions || isRequireDiscoveryOptions(adminOnlyPolicy);
} else {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.PORT.getLocalName()));
}
}
list.add(update);
return requireDiscoveryOptions;
} | java | private boolean parseRemoteDomainControllerAttributes_1_5(final XMLExtendedStreamReader reader, final ModelNode address,
final List<ModelNode> list, boolean allowDiscoveryOptions) throws XMLStreamException {
final ModelNode update = new ModelNode();
update.get(OP_ADDR).set(address);
update.get(OP).set(RemoteDomainControllerAddHandler.OPERATION_NAME);
// Handle attributes
AdminOnlyDomainConfigPolicy adminOnlyPolicy = AdminOnlyDomainConfigPolicy.DEFAULT;
boolean requireDiscoveryOptions = false;
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case HOST: {
DomainControllerWriteAttributeHandler.HOST.parseAndSetParameter(value, update, reader);
break;
}
case PORT: {
DomainControllerWriteAttributeHandler.PORT.parseAndSetParameter(value, update, reader);
break;
}
case SECURITY_REALM: {
DomainControllerWriteAttributeHandler.SECURITY_REALM.parseAndSetParameter(value, update, reader);
break;
}
case USERNAME: {
DomainControllerWriteAttributeHandler.USERNAME.parseAndSetParameter(value, update, reader);
break;
}
case ADMIN_ONLY_POLICY: {
DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.parseAndSetParameter(value, update, reader);
ModelNode nodeValue = update.get(DomainControllerWriteAttributeHandler.ADMIN_ONLY_POLICY.getName());
if (nodeValue.getType() != ModelType.EXPRESSION) {
adminOnlyPolicy = AdminOnlyDomainConfigPolicy.getPolicy(nodeValue.asString());
}
break;
}
default:
throw unexpectedAttribute(reader, i);
}
}
}
if (!update.hasDefined(DomainControllerWriteAttributeHandler.HOST.getName())) {
if (allowDiscoveryOptions) {
requireDiscoveryOptions = isRequireDiscoveryOptions(adminOnlyPolicy);
} else {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.HOST.getLocalName()));
}
}
if (!update.hasDefined(DomainControllerWriteAttributeHandler.PORT.getName())) {
if (allowDiscoveryOptions) {
requireDiscoveryOptions = requireDiscoveryOptions || isRequireDiscoveryOptions(adminOnlyPolicy);
} else {
throw ParseUtils.missingRequired(reader, Collections.singleton(Attribute.PORT.getLocalName()));
}
}
list.add(update);
return requireDiscoveryOptions;
} | [
"private",
"boolean",
"parseRemoteDomainControllerAttributes_1_5",
"(",
"final",
"XMLExtendedStreamReader",
"reader",
",",
"final",
"ModelNode",
"address",
",",
"final",
"List",
"<",
"ModelNode",
">",
"list",
",",
"boolean",
"allowDiscoveryOptions",
")",
"throws",
"XMLS... | The only difference between version 1.5 and 1.6 of the schema were to make is possible to define discovery options, this
resulted in the host and port attributes becoming optional -this method also indicates if discovery options are required
where the host and port were not supplied.
@param allowDiscoveryOptions i.e. are host and port potentially optional?
@return true if discovery options are required, i.e. no host and port set and the admin policy requires a config. | [
"The",
"only",
"difference",
"between",
"version",
"1",
".",
"5",
"and",
"1",
".",
"6",
"of",
"the",
"schema",
"were",
"to",
"make",
"is",
"possible",
"to",
"define",
"discovery",
"options",
"this",
"resulted",
"in",
"the",
"host",
"and",
"port",
"attrib... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/parsing/HostXml_Legacy.java#L1359-L1424 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java | RemoteProxyController.create | public static RemoteProxyController create(final TransactionalProtocolClient client, final PathAddress pathAddress,
final ProxyOperationAddressTranslator addressTranslator,
final ModelVersion targetKernelVersion) {
return new RemoteProxyController(client, pathAddress, addressTranslator, targetKernelVersion);
} | java | public static RemoteProxyController create(final TransactionalProtocolClient client, final PathAddress pathAddress,
final ProxyOperationAddressTranslator addressTranslator,
final ModelVersion targetKernelVersion) {
return new RemoteProxyController(client, pathAddress, addressTranslator, targetKernelVersion);
} | [
"public",
"static",
"RemoteProxyController",
"create",
"(",
"final",
"TransactionalProtocolClient",
"client",
",",
"final",
"PathAddress",
"pathAddress",
",",
"final",
"ProxyOperationAddressTranslator",
"addressTranslator",
",",
"final",
"ModelVersion",
"targetKernelVersion",
... | Create a new remote proxy controller.
@param client the transactional protocol client
@param pathAddress the path address
@param addressTranslator the address translator
@param targetKernelVersion the {@link ModelVersion} of the kernel management API exposed by the proxied process
@return the proxy controller | [
"Create",
"a",
"new",
"remote",
"proxy",
"controller",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java#L82-L86 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java | RemoteProxyController.create | @Deprecated
public static RemoteProxyController create(final ManagementChannelHandler channelAssociation, final PathAddress pathAddress, final ProxyOperationAddressTranslator addressTranslator) {
final TransactionalProtocolClient client = TransactionalProtocolHandlers.createClient(channelAssociation);
// the remote proxy
return create(client, pathAddress, addressTranslator, ModelVersion.CURRENT);
} | java | @Deprecated
public static RemoteProxyController create(final ManagementChannelHandler channelAssociation, final PathAddress pathAddress, final ProxyOperationAddressTranslator addressTranslator) {
final TransactionalProtocolClient client = TransactionalProtocolHandlers.createClient(channelAssociation);
// the remote proxy
return create(client, pathAddress, addressTranslator, ModelVersion.CURRENT);
} | [
"@",
"Deprecated",
"public",
"static",
"RemoteProxyController",
"create",
"(",
"final",
"ManagementChannelHandler",
"channelAssociation",
",",
"final",
"PathAddress",
"pathAddress",
",",
"final",
"ProxyOperationAddressTranslator",
"addressTranslator",
")",
"{",
"final",
"Tr... | Creates a new remote proxy controller using an existing channel.
@param channelAssociation the channel association
@param pathAddress the address within the model of the created proxy controller
@param addressTranslator the translator to use translating the address for the remote proxy
@return the proxy controller
@deprecated only present for test case use | [
"Creates",
"a",
"new",
"remote",
"proxy",
"controller",
"using",
"an",
"existing",
"channel",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java#L98-L103 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java | RemoteProxyController.translateOperationForProxy | public ModelNode translateOperationForProxy(final ModelNode op) {
return translateOperationForProxy(op, PathAddress.pathAddress(op.get(OP_ADDR)));
} | java | public ModelNode translateOperationForProxy(final ModelNode op) {
return translateOperationForProxy(op, PathAddress.pathAddress(op.get(OP_ADDR)));
} | [
"public",
"ModelNode",
"translateOperationForProxy",
"(",
"final",
"ModelNode",
"op",
")",
"{",
"return",
"translateOperationForProxy",
"(",
"op",
",",
"PathAddress",
".",
"pathAddress",
"(",
"op",
".",
"get",
"(",
"OP_ADDR",
")",
")",
")",
";",
"}"
] | Translate the operation address.
@param op the operation
@return the new operation | [
"Translate",
"the",
"operation",
"address",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/RemoteProxyController.java#L251-L253 | train |
wildfly/wildfly-core | process-controller/src/main/java/org/jboss/as/process/stdin/BaseNCodecOutputStream.java | BaseNCodecOutputStream.flush | private void flush(final boolean propagate) throws IOException {
final int avail = baseNCodec.available(context);
if (avail > 0) {
final byte[] buf = new byte[avail];
final int c = baseNCodec.readResults(buf, 0, avail, context);
if (c > 0) {
out.write(buf, 0, c);
}
}
if (propagate) {
out.flush();
}
} | java | private void flush(final boolean propagate) throws IOException {
final int avail = baseNCodec.available(context);
if (avail > 0) {
final byte[] buf = new byte[avail];
final int c = baseNCodec.readResults(buf, 0, avail, context);
if (c > 0) {
out.write(buf, 0, c);
}
}
if (propagate) {
out.flush();
}
} | [
"private",
"void",
"flush",
"(",
"final",
"boolean",
"propagate",
")",
"throws",
"IOException",
"{",
"final",
"int",
"avail",
"=",
"baseNCodec",
".",
"available",
"(",
"context",
")",
";",
"if",
"(",
"avail",
">",
"0",
")",
"{",
"final",
"byte",
"[",
"... | Flushes this output stream and forces any buffered output bytes to be written out to the stream. If propagate is
true, the wrapped stream will also be flushed.
@param propagate
boolean flag to indicate whether the wrapped OutputStream should also be flushed.
@throws IOException
if an I/O error occurs. | [
"Flushes",
"this",
"output",
"stream",
"and",
"forces",
"any",
"buffered",
"output",
"bytes",
"to",
"be",
"written",
"out",
"to",
"the",
"stream",
".",
"If",
"propagate",
"is",
"true",
"the",
"wrapped",
"stream",
"will",
"also",
"be",
"flushed",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/process-controller/src/main/java/org/jboss/as/process/stdin/BaseNCodecOutputStream.java#L115-L127 | train |
wildfly/wildfly-core | process-controller/src/main/java/org/jboss/as/process/stdin/BaseNCodecOutputStream.java | BaseNCodecOutputStream.close | @Override
public void close() throws IOException {
// Notify encoder of EOF (-1).
if (doEncode) {
baseNCodec.encode(singleByte, 0, EOF, context);
} else {
baseNCodec.decode(singleByte, 0, EOF, context);
}
flush();
out.close();
} | java | @Override
public void close() throws IOException {
// Notify encoder of EOF (-1).
if (doEncode) {
baseNCodec.encode(singleByte, 0, EOF, context);
} else {
baseNCodec.decode(singleByte, 0, EOF, context);
}
flush();
out.close();
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"// Notify encoder of EOF (-1).",
"if",
"(",
"doEncode",
")",
"{",
"baseNCodec",
".",
"encode",
"(",
"singleByte",
",",
"0",
",",
"EOF",
",",
"context",
")",
";",
"}",
"els... | Closes this output stream and releases any system resources associated with the stream.
@throws IOException
if an I/O error occurs. | [
"Closes",
"this",
"output",
"stream",
"and",
"releases",
"any",
"system",
"resources",
"associated",
"with",
"the",
"stream",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/process-controller/src/main/java/org/jboss/as/process/stdin/BaseNCodecOutputStream.java#L146-L156 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java | ExpressionResolverImpl.resolveExpressionsRecursively | private ModelNode resolveExpressionsRecursively(final ModelNode node) throws OperationFailedException {
if (!node.isDefined()) {
return node;
}
ModelType type = node.getType();
ModelNode resolved;
if (type == ModelType.EXPRESSION) {
resolved = resolveExpressionStringRecursively(node.asExpression().getExpressionString(), lenient, true);
} else if (type == ModelType.OBJECT) {
resolved = node.clone();
for (Property prop : resolved.asPropertyList()) {
resolved.get(prop.getName()).set(resolveExpressionsRecursively(prop.getValue()));
}
} else if (type == ModelType.LIST) {
resolved = node.clone();
ModelNode list = new ModelNode();
list.setEmptyList();
for (ModelNode current : resolved.asList()) {
list.add(resolveExpressionsRecursively(current));
}
resolved = list;
} else if (type == ModelType.PROPERTY) {
resolved = node.clone();
resolved.set(resolved.asProperty().getName(), resolveExpressionsRecursively(resolved.asProperty().getValue()));
} else {
resolved = node;
}
return resolved;
} | java | private ModelNode resolveExpressionsRecursively(final ModelNode node) throws OperationFailedException {
if (!node.isDefined()) {
return node;
}
ModelType type = node.getType();
ModelNode resolved;
if (type == ModelType.EXPRESSION) {
resolved = resolveExpressionStringRecursively(node.asExpression().getExpressionString(), lenient, true);
} else if (type == ModelType.OBJECT) {
resolved = node.clone();
for (Property prop : resolved.asPropertyList()) {
resolved.get(prop.getName()).set(resolveExpressionsRecursively(prop.getValue()));
}
} else if (type == ModelType.LIST) {
resolved = node.clone();
ModelNode list = new ModelNode();
list.setEmptyList();
for (ModelNode current : resolved.asList()) {
list.add(resolveExpressionsRecursively(current));
}
resolved = list;
} else if (type == ModelType.PROPERTY) {
resolved = node.clone();
resolved.set(resolved.asProperty().getName(), resolveExpressionsRecursively(resolved.asProperty().getValue()));
} else {
resolved = node;
}
return resolved;
} | [
"private",
"ModelNode",
"resolveExpressionsRecursively",
"(",
"final",
"ModelNode",
"node",
")",
"throws",
"OperationFailedException",
"{",
"if",
"(",
"!",
"node",
".",
"isDefined",
"(",
")",
")",
"{",
"return",
"node",
";",
"}",
"ModelType",
"type",
"=",
"nod... | Examine the given model node, resolving any expressions found within, including within child nodes.
@param node the node
@return a node with all expressions resolved
@throws OperationFailedException if an expression cannot be resolved | [
"Examine",
"the",
"given",
"model",
"node",
"resolving",
"any",
"expressions",
"found",
"within",
"including",
"within",
"child",
"nodes",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java#L76-L106 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java | ExpressionResolverImpl.resolveExpressionStringRecursively | private ModelNode resolveExpressionStringRecursively(final String expressionString, final boolean ignoreDMRResolutionFailure,
final boolean initial) throws OperationFailedException {
ParseAndResolveResult resolved = parseAndResolve(expressionString, ignoreDMRResolutionFailure);
if (resolved.recursive) {
// Some part of expressionString resolved into a different expression.
// So, start over, ignoring failures. Ignore failures because we don't require
// that expressions must not resolve to something that *looks like* an expression but isn't
return resolveExpressionStringRecursively(resolved.result, true, false);
} else if (resolved.modified) {
// Typical case
return new ModelNode(resolved.result);
} else if (initial && EXPRESSION_PATTERN.matcher(expressionString).matches()) {
// We should only get an unmodified expression string back if there was a resolution
// failure that we ignored.
assert ignoreDMRResolutionFailure;
// expressionString came from a node of type expression, so since we did nothing send it back in the same type
return new ModelNode(new ValueExpression(expressionString));
} else {
// The string wasn't really an expression. Two possible cases:
// 1) if initial == true, someone created a expression node with a non-expression string, which is legal
// 2) if initial == false, we resolved from an ModelType.EXPRESSION to a string that looked like an
// expression but can't be resolved. We don't require that expressions must not resolve to something that
// *looks like* an expression but isn't, so we'll just treat this as a string
return new ModelNode(expressionString);
}
} | java | private ModelNode resolveExpressionStringRecursively(final String expressionString, final boolean ignoreDMRResolutionFailure,
final boolean initial) throws OperationFailedException {
ParseAndResolveResult resolved = parseAndResolve(expressionString, ignoreDMRResolutionFailure);
if (resolved.recursive) {
// Some part of expressionString resolved into a different expression.
// So, start over, ignoring failures. Ignore failures because we don't require
// that expressions must not resolve to something that *looks like* an expression but isn't
return resolveExpressionStringRecursively(resolved.result, true, false);
} else if (resolved.modified) {
// Typical case
return new ModelNode(resolved.result);
} else if (initial && EXPRESSION_PATTERN.matcher(expressionString).matches()) {
// We should only get an unmodified expression string back if there was a resolution
// failure that we ignored.
assert ignoreDMRResolutionFailure;
// expressionString came from a node of type expression, so since we did nothing send it back in the same type
return new ModelNode(new ValueExpression(expressionString));
} else {
// The string wasn't really an expression. Two possible cases:
// 1) if initial == true, someone created a expression node with a non-expression string, which is legal
// 2) if initial == false, we resolved from an ModelType.EXPRESSION to a string that looked like an
// expression but can't be resolved. We don't require that expressions must not resolve to something that
// *looks like* an expression but isn't, so we'll just treat this as a string
return new ModelNode(expressionString);
}
} | [
"private",
"ModelNode",
"resolveExpressionStringRecursively",
"(",
"final",
"String",
"expressionString",
",",
"final",
"boolean",
"ignoreDMRResolutionFailure",
",",
"final",
"boolean",
"initial",
")",
"throws",
"OperationFailedException",
"{",
"ParseAndResolveResult",
"resol... | Attempt to resolve the given expression string, recursing if resolution of one string produces
another expression.
@param expressionString the expression string from a node of {@link ModelType#EXPRESSION}
@param ignoreDMRResolutionFailure {@code false} if {@link org.jboss.dmr.ModelNode#resolve() basic DMR resolution}
failures should be ignored, and {@code new ModelNode(expressionType.asString())} returned
@param initial {@code true} if this call originated outside this method; {@code false} if it is a recursive call
@return a node of {@link ModelType#STRING} where the encapsulated string is the resolved expression, or a node
of {@link ModelType#EXPRESSION} if {@code ignoreDMRResolutionFailure} and {@code initial} are
{@code true} and the string could not be resolved.
@throws OperationFailedException if the expression cannot be resolved | [
"Attempt",
"to",
"resolve",
"the",
"given",
"expression",
"string",
"recursing",
"if",
"resolution",
"of",
"one",
"string",
"produces",
"another",
"expression",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java#L141-L166 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java | ExpressionResolverImpl.resolveExpressionString | private String resolveExpressionString(final String unresolvedString) throws OperationFailedException {
// parseAndResolve should only be providing expressions with no leading or trailing chars
assert unresolvedString.startsWith("${") && unresolvedString.endsWith("}");
// Default result is no change from input
String result = unresolvedString;
ModelNode resolveNode = new ModelNode(new ValueExpression(unresolvedString));
// Try plug-in resolution; i.e. vault
resolvePluggableExpression(resolveNode);
if (resolveNode.getType() == ModelType.EXPRESSION ) {
// resolvePluggableExpression did nothing. Try standard resolution
String resolvedString = resolveStandardExpression(resolveNode);
if (!unresolvedString.equals(resolvedString)) {
// resolveStandardExpression made progress
result = resolvedString;
} // else there is nothing more we can do with this string
} else {
// resolvePluggableExpression made progress
result = resolveNode.asString();
}
return result;
} | java | private String resolveExpressionString(final String unresolvedString) throws OperationFailedException {
// parseAndResolve should only be providing expressions with no leading or trailing chars
assert unresolvedString.startsWith("${") && unresolvedString.endsWith("}");
// Default result is no change from input
String result = unresolvedString;
ModelNode resolveNode = new ModelNode(new ValueExpression(unresolvedString));
// Try plug-in resolution; i.e. vault
resolvePluggableExpression(resolveNode);
if (resolveNode.getType() == ModelType.EXPRESSION ) {
// resolvePluggableExpression did nothing. Try standard resolution
String resolvedString = resolveStandardExpression(resolveNode);
if (!unresolvedString.equals(resolvedString)) {
// resolveStandardExpression made progress
result = resolvedString;
} // else there is nothing more we can do with this string
} else {
// resolvePluggableExpression made progress
result = resolveNode.asString();
}
return result;
} | [
"private",
"String",
"resolveExpressionString",
"(",
"final",
"String",
"unresolvedString",
")",
"throws",
"OperationFailedException",
"{",
"// parseAndResolve should only be providing expressions with no leading or trailing chars",
"assert",
"unresolvedString",
".",
"startsWith",
"(... | Resolve the given string using any plugin and the DMR resolve method | [
"Resolve",
"the",
"given",
"string",
"using",
"any",
"plugin",
"and",
"the",
"DMR",
"resolve",
"method"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ExpressionResolverImpl.java#L330-L356 | train |
wildfly/wildfly-core | security-manager/src/main/java/org/wildfly/extension/security/manager/deployment/PermissionsParser.java | PermissionsParser.unexpectedElement | private static XMLStreamException unexpectedElement(final XMLStreamReader reader) {
return SecurityManagerLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), reader.getLocation());
} | java | private static XMLStreamException unexpectedElement(final XMLStreamReader reader) {
return SecurityManagerLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), reader.getLocation());
} | [
"private",
"static",
"XMLStreamException",
"unexpectedElement",
"(",
"final",
"XMLStreamReader",
"reader",
")",
"{",
"return",
"SecurityManagerLogger",
".",
"ROOT_LOGGER",
".",
"unexpectedElement",
"(",
"reader",
".",
"getName",
"(",
")",
",",
"reader",
".",
"getLoc... | Gets an exception reporting an unexpected XML element.
@param reader a reference to the stream reader.
@return the constructed {@link javax.xml.stream.XMLStreamException}. | [
"Gets",
"an",
"exception",
"reporting",
"an",
"unexpected",
"XML",
"element",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/security-manager/src/main/java/org/wildfly/extension/security/manager/deployment/PermissionsParser.java#L263-L265 | train |
wildfly/wildfly-core | security-manager/src/main/java/org/wildfly/extension/security/manager/deployment/PermissionsParser.java | PermissionsParser.unexpectedAttribute | private static XMLStreamException unexpectedAttribute(final XMLStreamReader reader, final int index) {
return SecurityManagerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation());
} | java | private static XMLStreamException unexpectedAttribute(final XMLStreamReader reader, final int index) {
return SecurityManagerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation());
} | [
"private",
"static",
"XMLStreamException",
"unexpectedAttribute",
"(",
"final",
"XMLStreamReader",
"reader",
",",
"final",
"int",
"index",
")",
"{",
"return",
"SecurityManagerLogger",
".",
"ROOT_LOGGER",
".",
"unexpectedAttribute",
"(",
"reader",
".",
"getAttributeName"... | Gets an exception reporting an unexpected XML attribute.
@param reader a reference to the stream reader.
@param index the attribute index.
@return the constructed {@link javax.xml.stream.XMLStreamException}. | [
"Gets",
"an",
"exception",
"reporting",
"an",
"unexpected",
"XML",
"attribute",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/security-manager/src/main/java/org/wildfly/extension/security/manager/deployment/PermissionsParser.java#L274-L276 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java | DeploymentUploadUtil.storeContentAndTransformOperation | public static byte[] storeContentAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws IOException, OperationFailedException {
if (!operation.hasDefined(CONTENT)) {
throw createFailureException(DomainControllerLogger.ROOT_LOGGER.invalidContentDeclaration());
}
final ModelNode content = operation.get(CONTENT).get(0);
if (content.hasDefined(HASH)) {
// This should be handled as part of the OSH
throw createFailureException(DomainControllerLogger.ROOT_LOGGER.invalidContentDeclaration());
}
final byte[] hash = storeDeploymentContent(context, operation, contentRepository);
// Clear the contents and update with the hash
final ModelNode slave = operation.clone();
slave.get(CONTENT).setEmptyList().add().get(HASH).set(hash);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | java | public static byte[] storeContentAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws IOException, OperationFailedException {
if (!operation.hasDefined(CONTENT)) {
throw createFailureException(DomainControllerLogger.ROOT_LOGGER.invalidContentDeclaration());
}
final ModelNode content = operation.get(CONTENT).get(0);
if (content.hasDefined(HASH)) {
// This should be handled as part of the OSH
throw createFailureException(DomainControllerLogger.ROOT_LOGGER.invalidContentDeclaration());
}
final byte[] hash = storeDeploymentContent(context, operation, contentRepository);
// Clear the contents and update with the hash
final ModelNode slave = operation.clone();
slave.get(CONTENT).setEmptyList().add().get(HASH).set(hash);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | [
"public",
"static",
"byte",
"[",
"]",
"storeContentAndTransformOperation",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"ContentRepository",
"contentRepository",
")",
"throws",
"IOException",
",",
"OperationFailedException",
"{",
"if",
"(",
"!... | Store the deployment contents and attach a "transformed" slave operation to the operation context.
@param context the operation context
@param operation the original operation
@param contentRepository the content repository
@return the hash of the uploaded deployment content
@throws IOException
@throws OperationFailedException | [
"Store",
"the",
"deployment",
"contents",
"and",
"attach",
"a",
"transformed",
"slave",
"operation",
"to",
"the",
"operation",
"context",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java#L91-L112 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java | DeploymentUploadUtil.explodeContentAndTransformOperation | public static byte[] explodeContentAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItem = getContentItem(deploymentResource);
ModelNode explodedPath = DEPLOYMENT_CONTENT_PATH.resolveModelAttribute(context, operation);
byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItem).asBytes();
final byte[] hash;
if (explodedPath.isDefined()) {
hash = contentRepository.explodeSubContent(oldHash, explodedPath.asString());
} else {
hash = contentRepository.explodeContent(oldHash);
}
// Clear the contents and update with the hash
final ModelNode slave = operation.clone();
ModelNode addedContent = new ModelNode().setEmptyObject();
addedContent.get(HASH).set(hash);
addedContent.get(TARGET_PATH.getName()).set("./");
slave.get(CONTENT).setEmptyList().add(addedContent);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | java | public static byte[] explodeContentAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItem = getContentItem(deploymentResource);
ModelNode explodedPath = DEPLOYMENT_CONTENT_PATH.resolveModelAttribute(context, operation);
byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItem).asBytes();
final byte[] hash;
if (explodedPath.isDefined()) {
hash = contentRepository.explodeSubContent(oldHash, explodedPath.asString());
} else {
hash = contentRepository.explodeContent(oldHash);
}
// Clear the contents and update with the hash
final ModelNode slave = operation.clone();
ModelNode addedContent = new ModelNode().setEmptyObject();
addedContent.get(HASH).set(hash);
addedContent.get(TARGET_PATH.getName()).set("./");
slave.get(CONTENT).setEmptyList().add(addedContent);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | [
"public",
"static",
"byte",
"[",
"]",
"explodeContentAndTransformOperation",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"ContentRepository",
"contentRepository",
")",
"throws",
"OperationFailedException",
",",
"ExplodedContentException",
"{",
"f... | Explode the deployment contents and attach a "transformed" slave operation to the operation context.
@param context the operation context
@param operation the original operation
@param contentRepository the content repository
@return the hash of the uploaded deployment content
@throws IOException
@throws OperationFailedException | [
"Explode",
"the",
"deployment",
"contents",
"and",
"attach",
"a",
"transformed",
"slave",
"operation",
"to",
"the",
"operation",
"context",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java#L143-L168 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java | DeploymentUploadUtil.addContentToExplodedAndTransformOperation | public static byte[] addContentToExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItem = getContentItem(deploymentResource);
byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItem).asBytes();
List<ModelNode> contents = CONTENT_PARAM_ALL_EXPLODED.resolveModelAttribute(context, operation).asList();
final List<ExplodedContent> addedFiles = new ArrayList<>(contents.size());
final ModelNode slave = operation.clone();
ModelNode slaveAddedfiles = slave.get(UPDATED_PATHS.getName()).setEmptyList();
for(ModelNode content : contents) {
InputStream in;
if(hasValidContentAdditionParameterDefined(content)) {
in = getInputStream(context, content);
} else {
in = null;
}
String path = TARGET_PATH.resolveModelAttribute(context, content).asString();
addedFiles.add(new ExplodedContent(path, in));
slaveAddedfiles.add(path);
}
final boolean overwrite = OVERWRITE.resolveModelAttribute(context, operation).asBoolean(true);
final byte[] hash = contentRepository.addContentToExploded(oldHash, addedFiles, overwrite);
// Clear the contents and update with the hash
ModelNode addedContent = new ModelNode().setEmptyObject();
addedContent.get(HASH).set(hash);
addedContent.get(TARGET_PATH.getName()).set(".");
slave.get(CONTENT).setEmptyList().add(addedContent);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | java | public static byte[] addContentToExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItem = getContentItem(deploymentResource);
byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItem).asBytes();
List<ModelNode> contents = CONTENT_PARAM_ALL_EXPLODED.resolveModelAttribute(context, operation).asList();
final List<ExplodedContent> addedFiles = new ArrayList<>(contents.size());
final ModelNode slave = operation.clone();
ModelNode slaveAddedfiles = slave.get(UPDATED_PATHS.getName()).setEmptyList();
for(ModelNode content : contents) {
InputStream in;
if(hasValidContentAdditionParameterDefined(content)) {
in = getInputStream(context, content);
} else {
in = null;
}
String path = TARGET_PATH.resolveModelAttribute(context, content).asString();
addedFiles.add(new ExplodedContent(path, in));
slaveAddedfiles.add(path);
}
final boolean overwrite = OVERWRITE.resolveModelAttribute(context, operation).asBoolean(true);
final byte[] hash = contentRepository.addContentToExploded(oldHash, addedFiles, overwrite);
// Clear the contents and update with the hash
ModelNode addedContent = new ModelNode().setEmptyObject();
addedContent.get(HASH).set(hash);
addedContent.get(TARGET_PATH.getName()).set(".");
slave.get(CONTENT).setEmptyList().add(addedContent);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | [
"public",
"static",
"byte",
"[",
"]",
"addContentToExplodedAndTransformOperation",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"ContentRepository",
"contentRepository",
")",
"throws",
"OperationFailedException",
",",
"ExplodedContentException",
"{"... | Add contents to the deployment and attach a "transformed" slave operation to the operation context.
@param context the operation context
@param operation the original operation
@param contentRepository the content repository
@return the hash of the uploaded deployment content
@throws IOException
@throws OperationFailedException | [
"Add",
"contents",
"to",
"the",
"deployment",
"and",
"attach",
"a",
"transformed",
"slave",
"operation",
"to",
"the",
"operation",
"context",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java#L180-L215 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java | DeploymentUploadUtil.removeContentFromExplodedAndTransformOperation | public static byte[] removeContentFromExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItemNode = getContentItem(deploymentResource);
final byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItemNode).asBytes();
final List<String> paths = REMOVED_PATHS.unwrap(context, operation);
final byte[] hash = contentRepository.removeContentFromExploded(oldHash, paths);
// Clear the contents and update with the hash
final ModelNode slave = operation.clone();
slave.get(CONTENT).setEmptyList().add().get(HASH).set(hash);
slave.get(CONTENT).add().get(ARCHIVE).set(false);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | java | public static byte[] removeContentFromExplodedAndTransformOperation(OperationContext context, ModelNode operation, ContentRepository contentRepository) throws OperationFailedException, ExplodedContentException {
final Resource deploymentResource = context.readResource(PathAddress.EMPTY_ADDRESS);
ModelNode contentItemNode = getContentItem(deploymentResource);
final byte[] oldHash = CONTENT_HASH.resolveModelAttribute(context, contentItemNode).asBytes();
final List<String> paths = REMOVED_PATHS.unwrap(context, operation);
final byte[] hash = contentRepository.removeContentFromExploded(oldHash, paths);
// Clear the contents and update with the hash
final ModelNode slave = operation.clone();
slave.get(CONTENT).setEmptyList().add().get(HASH).set(hash);
slave.get(CONTENT).add().get(ARCHIVE).set(false);
// Add the domain op transformer
List<DomainOperationTransmuter> transformers = context.getAttachment(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS);
if (transformers == null) {
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>());
}
transformers.add(new CompositeOperationAwareTransmuter(slave));
return hash;
} | [
"public",
"static",
"byte",
"[",
"]",
"removeContentFromExplodedAndTransformOperation",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"operation",
",",
"ContentRepository",
"contentRepository",
")",
"throws",
"OperationFailedException",
",",
"ExplodedContentException",
... | Remove contents from the deployment and attach a "transformed" slave operation to the operation context.
@param context the operation context
@param operation the original operation
@param contentRepository the content repository
@return the hash of the uploaded deployment content
@throws IOException
@throws OperationFailedException | [
"Remove",
"contents",
"from",
"the",
"deployment",
"and",
"attach",
"a",
"transformed",
"slave",
"operation",
"to",
"the",
"operation",
"context",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java#L227-L245 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java | DeploymentUploadUtil.synchronizeSlaveHostController | public static byte[] synchronizeSlaveHostController(ModelNode operation, final PathAddress address, HostFileRepository fileRepository, ContentRepository contentRepository, boolean backup, byte[] oldHash) {
ModelNode operationContentItem = operation.get(DeploymentAttributes.CONTENT_RESOURCE_ALL.getName()).get(0);
byte[] newHash = operationContentItem.require(CONTENT_HASH.getName()).asBytes();
if (needRemoteContent(fileRepository, contentRepository, backup, oldHash)) { // backup DC needs to pull the content
fileRepository.getDeploymentFiles(ModelContentReference.fromModelAddress(address, newHash));
}
return newHash;
} | java | public static byte[] synchronizeSlaveHostController(ModelNode operation, final PathAddress address, HostFileRepository fileRepository, ContentRepository contentRepository, boolean backup, byte[] oldHash) {
ModelNode operationContentItem = operation.get(DeploymentAttributes.CONTENT_RESOURCE_ALL.getName()).get(0);
byte[] newHash = operationContentItem.require(CONTENT_HASH.getName()).asBytes();
if (needRemoteContent(fileRepository, contentRepository, backup, oldHash)) { // backup DC needs to pull the content
fileRepository.getDeploymentFiles(ModelContentReference.fromModelAddress(address, newHash));
}
return newHash;
} | [
"public",
"static",
"byte",
"[",
"]",
"synchronizeSlaveHostController",
"(",
"ModelNode",
"operation",
",",
"final",
"PathAddress",
"address",
",",
"HostFileRepository",
"fileRepository",
",",
"ContentRepository",
"contentRepository",
",",
"boolean",
"backup",
",",
"byt... | Synchronize the required files to a slave HC from the master DC if this is required.
@param fileRepository the HostFileRepository of the HC.
@param contentRepository the ContentRepository of the HC.
@param backup inidcates if this is a DC backup HC.
@param oldHash the hash of the deployment to be replaced.
@return true if the content should be pulled by the slave HC - false otherwise. | [
"Synchronize",
"the",
"required",
"files",
"to",
"a",
"slave",
"HC",
"from",
"the",
"master",
"DC",
"if",
"this",
"is",
"required",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/deployment/DeploymentUploadUtil.java#L255-L262 | train |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/annotation/AnnotationIndexProcessor.java | AnnotationIndexProcessor.deploy | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
for (ResourceRoot resourceRoot : DeploymentUtils.allResourceRoots(deploymentUnit)) {
ResourceRootIndexer.indexResourceRoot(resourceRoot);
}
} | java | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
for (ResourceRoot resourceRoot : DeploymentUtils.allResourceRoots(deploymentUnit)) {
ResourceRootIndexer.indexResourceRoot(resourceRoot);
}
} | [
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"for",
"(",
"ResourceRoot",
"re... | Process this deployment for annotations. This will use an annotation indexer to create an index of all annotations
found in this deployment and attach it to the deployment unit context.
@param phaseContext the deployment unit context
@throws DeploymentUnitProcessingException | [
"Process",
"this",
"deployment",
"for",
"annotations",
".",
"This",
"will",
"use",
"an",
"annotation",
"indexer",
"to",
"create",
"an",
"index",
"of",
"all",
"annotations",
"found",
"in",
"this",
"deployment",
"and",
"attach",
"it",
"to",
"the",
"deployment",
... | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/annotation/AnnotationIndexProcessor.java#L48-L53 | train |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/IoUtils.java | IoUtils.newFile | public static File newFile(File baseDir, String... segments) {
File f = baseDir;
for (String segment : segments) {
f = new File(f, segment);
}
return f;
} | java | public static File newFile(File baseDir, String... segments) {
File f = baseDir;
for (String segment : segments) {
f = new File(f, segment);
}
return f;
} | [
"public",
"static",
"File",
"newFile",
"(",
"File",
"baseDir",
",",
"String",
"...",
"segments",
")",
"{",
"File",
"f",
"=",
"baseDir",
";",
"for",
"(",
"String",
"segment",
":",
"segments",
")",
"{",
"f",
"=",
"new",
"File",
"(",
"f",
",",
"segment"... | Return a new File object based on the baseDir and the segments.
This method does not perform any operation on the file system. | [
"Return",
"a",
"new",
"File",
"object",
"based",
"on",
"the",
"baseDir",
"and",
"the",
"segments",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/IoUtils.java#L208-L214 | train |
wildfly/wildfly-core | domain-management/src/main/java/org/jboss/as/domain/management/security/password/PasswordCheckUtil.java | PasswordCheckUtil.check | public PasswordCheckResult check(boolean isAdminitrative, String userName, String password) {
// TODO: allow custom restrictions?
List<PasswordRestriction> passwordValuesRestrictions = getPasswordRestrictions();
final PasswordStrengthCheckResult strengthResult = this.passwordStrengthChecker.check(userName, password, passwordValuesRestrictions);
final int failedRestrictions = strengthResult.getRestrictionFailures().size();
final PasswordStrength strength = strengthResult.getStrength();
final boolean strongEnough = assertStrength(strength);
PasswordCheckResult.Result resultAction;
String resultMessage = null;
if (isAdminitrative) {
if (strongEnough) {
if (failedRestrictions > 0) {
resultAction = Result.WARN;
resultMessage = strengthResult.getRestrictionFailures().get(0).getMessage();
} else {
resultAction = Result.ACCEPT;
}
} else {
resultAction = Result.WARN;
resultMessage = ROOT_LOGGER.passwordNotStrongEnough(strength.toString(), this.acceptable.toString());
}
} else {
if (strongEnough) {
if (failedRestrictions > 0) {
resultAction = Result.REJECT;
resultMessage = strengthResult.getRestrictionFailures().get(0).getMessage();
} else {
resultAction = Result.ACCEPT;
}
} else {
if (failedRestrictions > 0) {
resultAction = Result.REJECT;
resultMessage = strengthResult.getRestrictionFailures().get(0).getMessage();
} else {
resultAction = Result.REJECT;
resultMessage = ROOT_LOGGER.passwordNotStrongEnough(strength.toString(), this.acceptable.toString());
}
}
}
return new PasswordCheckResult(resultAction, resultMessage);
} | java | public PasswordCheckResult check(boolean isAdminitrative, String userName, String password) {
// TODO: allow custom restrictions?
List<PasswordRestriction> passwordValuesRestrictions = getPasswordRestrictions();
final PasswordStrengthCheckResult strengthResult = this.passwordStrengthChecker.check(userName, password, passwordValuesRestrictions);
final int failedRestrictions = strengthResult.getRestrictionFailures().size();
final PasswordStrength strength = strengthResult.getStrength();
final boolean strongEnough = assertStrength(strength);
PasswordCheckResult.Result resultAction;
String resultMessage = null;
if (isAdminitrative) {
if (strongEnough) {
if (failedRestrictions > 0) {
resultAction = Result.WARN;
resultMessage = strengthResult.getRestrictionFailures().get(0).getMessage();
} else {
resultAction = Result.ACCEPT;
}
} else {
resultAction = Result.WARN;
resultMessage = ROOT_LOGGER.passwordNotStrongEnough(strength.toString(), this.acceptable.toString());
}
} else {
if (strongEnough) {
if (failedRestrictions > 0) {
resultAction = Result.REJECT;
resultMessage = strengthResult.getRestrictionFailures().get(0).getMessage();
} else {
resultAction = Result.ACCEPT;
}
} else {
if (failedRestrictions > 0) {
resultAction = Result.REJECT;
resultMessage = strengthResult.getRestrictionFailures().get(0).getMessage();
} else {
resultAction = Result.REJECT;
resultMessage = ROOT_LOGGER.passwordNotStrongEnough(strength.toString(), this.acceptable.toString());
}
}
}
return new PasswordCheckResult(resultAction, resultMessage);
} | [
"public",
"PasswordCheckResult",
"check",
"(",
"boolean",
"isAdminitrative",
",",
"String",
"userName",
",",
"String",
"password",
")",
"{",
"// TODO: allow custom restrictions?",
"List",
"<",
"PasswordRestriction",
">",
"passwordValuesRestrictions",
"=",
"getPasswordRestri... | Method which performs strength checks on password. It returns outcome which can be used by CLI.
@param isAdminitrative - administrative checks are less restrictive. This means that weak password or one which violates restrictions is not indicated as failure.
Administrative checks are usually performed by admin changing/setting default password for user.
@param userName - the name of user for which password is set.
@param password - password.
@return | [
"Method",
"which",
"performs",
"strength",
"checks",
"on",
"password",
".",
"It",
"returns",
"outcome",
"which",
"can",
"be",
"used",
"by",
"CLI",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/password/PasswordCheckUtil.java#L246-L290 | train |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/gui/component/ServerGroupChooser.java | ServerGroupChooser.getCmdLineArg | public String getCmdLineArg() {
StringBuilder builder = new StringBuilder(" --server-groups=");
boolean foundSelected = false;
for (JCheckBox serverGroup : serverGroups) {
if (serverGroup.isSelected()) {
foundSelected = true;
builder.append(serverGroup.getText());
builder.append(",");
}
}
builder.deleteCharAt(builder.length() - 1); // remove trailing comma
if (!foundSelected) return "";
return builder.toString();
} | java | public String getCmdLineArg() {
StringBuilder builder = new StringBuilder(" --server-groups=");
boolean foundSelected = false;
for (JCheckBox serverGroup : serverGroups) {
if (serverGroup.isSelected()) {
foundSelected = true;
builder.append(serverGroup.getText());
builder.append(",");
}
}
builder.deleteCharAt(builder.length() - 1); // remove trailing comma
if (!foundSelected) return "";
return builder.toString();
} | [
"public",
"String",
"getCmdLineArg",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"\" --server-groups=\"",
")",
";",
"boolean",
"foundSelected",
"=",
"false",
";",
"for",
"(",
"JCheckBox",
"serverGroup",
":",
"serverGroups",
")",
... | Return the command line argument
@return " --server-groups=" plus a comma-separated list
of selected server groups. Return empty String if none selected. | [
"Return",
"the",
"command",
"line",
"argument"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/component/ServerGroupChooser.java#L79-L93 | train |
wildfly/wildfly-core | deployment-scanner/src/main/java/org/jboss/as/server/deployment/scanner/ZipCompletionScanner.java | ZipCompletionScanner.isCompleteZip | public static boolean isCompleteZip(File file) throws IOException, NonScannableZipException {
FileChannel channel = null;
try {
channel = new FileInputStream(file).getChannel();
long size = channel.size();
if (size < ENDLEN) { // Obvious case
return false;
}
else if (validateEndRecord(file, channel, size - ENDLEN)) { // typical case where file is complete and end record has no comment
return true;
}
// Either file is incomplete or the end of central directory record includes an arbitrary length comment
// So, we have to scan backwards looking for an end of central directory record
return scanForEndSig(file, channel);
}
finally {
safeClose(channel);
}
} | java | public static boolean isCompleteZip(File file) throws IOException, NonScannableZipException {
FileChannel channel = null;
try {
channel = new FileInputStream(file).getChannel();
long size = channel.size();
if (size < ENDLEN) { // Obvious case
return false;
}
else if (validateEndRecord(file, channel, size - ENDLEN)) { // typical case where file is complete and end record has no comment
return true;
}
// Either file is incomplete or the end of central directory record includes an arbitrary length comment
// So, we have to scan backwards looking for an end of central directory record
return scanForEndSig(file, channel);
}
finally {
safeClose(channel);
}
} | [
"public",
"static",
"boolean",
"isCompleteZip",
"(",
"File",
"file",
")",
"throws",
"IOException",
",",
"NonScannableZipException",
"{",
"FileChannel",
"channel",
"=",
"null",
";",
"try",
"{",
"channel",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
".",
"g... | Scans the given file looking for a complete zip file format end of central directory record.
@param file the file
@return true if a complete end of central directory record could be found
@throws IOException | [
"Scans",
"the",
"given",
"file",
"looking",
"for",
"a",
"complete",
"zip",
"file",
"format",
"end",
"of",
"central",
"directory",
"record",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-scanner/src/main/java/org/jboss/as/server/deployment/scanner/ZipCompletionScanner.java#L107-L128 | train |
wildfly/wildfly-core | deployment-scanner/src/main/java/org/jboss/as/server/deployment/scanner/ZipCompletionScanner.java | ZipCompletionScanner.scanForEndSig | private static boolean scanForEndSig(File file, FileChannel channel) throws IOException, NonScannableZipException {
// 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;
boolean firstRead = true;
while (lastChannelPos >= end) {
read(bb, channel, channelPos);
int actualRead = bb.limit();
if (firstRead) {
long expectedRead = Math.min(CHUNK_SIZE, start);
if (actualRead > expectedRead) {
// File is still growing
return false;
}
firstRead = false;
}
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 && ENDSIG_PATTERN[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: {
// 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)) {
return true;
}
// 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 -= END_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 false;
} | java | private static boolean scanForEndSig(File file, FileChannel channel) throws IOException, NonScannableZipException {
// 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;
boolean firstRead = true;
while (lastChannelPos >= end) {
read(bb, channel, channelPos);
int actualRead = bb.limit();
if (firstRead) {
long expectedRead = Math.min(CHUNK_SIZE, start);
if (actualRead > expectedRead) {
// File is still growing
return false;
}
firstRead = false;
}
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 && ENDSIG_PATTERN[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: {
// 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)) {
return true;
}
// 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 -= END_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 false;
} | [
"private",
"static",
"boolean",
"scanForEndSig",
"(",
"File",
"file",
",",
"FileChannel",
"channel",
")",
"throws",
"IOException",
",",
"NonScannableZipException",
"{",
"// TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex",
"ByteBu... | Boyer Moore scan that proceeds backwards from the end of the file looking for ENDSIG
@throws NonScannableZipException | [
"Boyer",
"Moore",
"scan",
"that",
"proceeds",
"backwards",
"from",
"the",
"end",
"of",
"the",
"file",
"looking",
"for",
"ENDSIG"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-scanner/src/main/java/org/jboss/as/server/deployment/scanner/ZipCompletionScanner.java#L216-L290 | train |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/mgmt/HostControllerRegistrationHandler.java | HostControllerRegistrationHandler.sendFailedResponse | static void sendFailedResponse(final ManagementRequestContext<RegistrationContext> context, final byte errorCode, final String message) throws IOException {
final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader());
final FlushableDataOutput output = context.writeMessage(header);
try {
// This is an error
output.writeByte(DomainControllerProtocol.PARAM_ERROR);
// send error code
output.writeByte(errorCode);
// error message
if (message == null) {
output.writeUTF("unknown error");
} else {
output.writeUTF(message);
}
// response end
output.writeByte(ManagementProtocol.RESPONSE_END);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | java | static void sendFailedResponse(final ManagementRequestContext<RegistrationContext> context, final byte errorCode, final String message) throws IOException {
final ManagementResponseHeader header = ManagementResponseHeader.create(context.getRequestHeader());
final FlushableDataOutput output = context.writeMessage(header);
try {
// This is an error
output.writeByte(DomainControllerProtocol.PARAM_ERROR);
// send error code
output.writeByte(errorCode);
// error message
if (message == null) {
output.writeUTF("unknown error");
} else {
output.writeUTF(message);
}
// response end
output.writeByte(ManagementProtocol.RESPONSE_END);
output.close();
} finally {
StreamUtils.safeClose(output);
}
} | [
"static",
"void",
"sendFailedResponse",
"(",
"final",
"ManagementRequestContext",
"<",
"RegistrationContext",
">",
"context",
",",
"final",
"byte",
"errorCode",
",",
"final",
"String",
"message",
")",
"throws",
"IOException",
"{",
"final",
"ManagementResponseHeader",
... | Send a failed operation response.
@param context the request context
@param errorCode the error code
@param message the operation message
@throws IOException for any error | [
"Send",
"a",
"failed",
"operation",
"response",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/mgmt/HostControllerRegistrationHandler.java#L745-L765 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/resource/InterfaceDefinition.java | InterfaceDefinition.isOperationDefined | public static boolean isOperationDefined(final ModelNode operation) {
for (final AttributeDefinition def : ROOT_ATTRIBUTES) {
if (operation.hasDefined(def.getName())) {
return true;
}
}
return false;
} | java | public static boolean isOperationDefined(final ModelNode operation) {
for (final AttributeDefinition def : ROOT_ATTRIBUTES) {
if (operation.hasDefined(def.getName())) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isOperationDefined",
"(",
"final",
"ModelNode",
"operation",
")",
"{",
"for",
"(",
"final",
"AttributeDefinition",
"def",
":",
"ROOT_ATTRIBUTES",
")",
"{",
"if",
"(",
"operation",
".",
"hasDefined",
"(",
"def",
".",
"getName",
"... | Test whether the operation has a defined criteria attribute.
@param operation the operation
@return | [
"Test",
"whether",
"the",
"operation",
"has",
"a",
"defined",
"criteria",
"attribute",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/resource/InterfaceDefinition.java#L200-L207 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/resource/InterfaceDefinition.java | InterfaceDefinition.wrapAsList | @Deprecated
private static ListAttributeDefinition wrapAsList(final AttributeDefinition def) {
final ListAttributeDefinition list = new ListAttributeDefinition(new SimpleListAttributeDefinition.Builder(def.getName(), def)
.setElementValidator(def.getValidator())) {
@Override
public ModelNode getNoTextDescription(boolean forOperation) {
final ModelNode model = super.getNoTextDescription(forOperation);
setValueType(model);
return model;
}
@Override
protected void addValueTypeDescription(final ModelNode node, final ResourceBundle bundle) {
setValueType(node);
}
@Override
public void marshallAsElement(final ModelNode resourceModel, final boolean marshalDefault, final XMLStreamWriter writer) throws XMLStreamException {
throw new RuntimeException();
}
@Override
protected void addAttributeValueTypeDescription(ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
@Override
protected void addOperationParameterValueTypeDescription(ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
private void setValueType(ModelNode node) {
node.get(ModelDescriptionConstants.VALUE_TYPE).set(ModelType.STRING);
}
};
return list;
} | java | @Deprecated
private static ListAttributeDefinition wrapAsList(final AttributeDefinition def) {
final ListAttributeDefinition list = new ListAttributeDefinition(new SimpleListAttributeDefinition.Builder(def.getName(), def)
.setElementValidator(def.getValidator())) {
@Override
public ModelNode getNoTextDescription(boolean forOperation) {
final ModelNode model = super.getNoTextDescription(forOperation);
setValueType(model);
return model;
}
@Override
protected void addValueTypeDescription(final ModelNode node, final ResourceBundle bundle) {
setValueType(node);
}
@Override
public void marshallAsElement(final ModelNode resourceModel, final boolean marshalDefault, final XMLStreamWriter writer) throws XMLStreamException {
throw new RuntimeException();
}
@Override
protected void addAttributeValueTypeDescription(ModelNode node, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
@Override
protected void addOperationParameterValueTypeDescription(ModelNode node, String operationName, ResourceDescriptionResolver resolver, Locale locale, ResourceBundle bundle) {
setValueType(node);
}
private void setValueType(ModelNode node) {
node.get(ModelDescriptionConstants.VALUE_TYPE).set(ModelType.STRING);
}
};
return list;
} | [
"@",
"Deprecated",
"private",
"static",
"ListAttributeDefinition",
"wrapAsList",
"(",
"final",
"AttributeDefinition",
"def",
")",
"{",
"final",
"ListAttributeDefinition",
"list",
"=",
"new",
"ListAttributeDefinition",
"(",
"new",
"SimpleListAttributeDefinition",
".",
"Bui... | Wrap a simple attribute def as list.
@param def the attribute definition
@return the list attribute def | [
"Wrap",
"a",
"simple",
"attribute",
"def",
"as",
"list",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/resource/InterfaceDefinition.java#L309-L347 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/BlockingTimeoutImpl.java | BlockingTimeoutImpl.resolveDomainTimeoutAdder | private static int resolveDomainTimeoutAdder() {
String propValue = WildFlySecurityManager.getPropertyPrivileged(DOMAIN_TEST_SYSTEM_PROPERTY, DEFAULT_DOMAIN_TIMEOUT_STRING);
if (sysPropDomainValue == null || !sysPropDomainValue.equals(propValue)) {
// First call or the system property changed
sysPropDomainValue = propValue;
int number = -1;
try {
number = Integer.valueOf(sysPropDomainValue);
} catch (NumberFormatException nfe) {
// ignored
}
if (number > 0) {
defaultDomainValue = number; // this one is in ms
} else {
ControllerLogger.MGMT_OP_LOGGER.invalidDefaultBlockingTimeout(sysPropDomainValue, DOMAIN_TEST_SYSTEM_PROPERTY, DEFAULT_DOMAIN_TIMEOUT_ADDER);
defaultDomainValue = DEFAULT_DOMAIN_TIMEOUT_ADDER;
}
}
return defaultDomainValue;
} | java | private static int resolveDomainTimeoutAdder() {
String propValue = WildFlySecurityManager.getPropertyPrivileged(DOMAIN_TEST_SYSTEM_PROPERTY, DEFAULT_DOMAIN_TIMEOUT_STRING);
if (sysPropDomainValue == null || !sysPropDomainValue.equals(propValue)) {
// First call or the system property changed
sysPropDomainValue = propValue;
int number = -1;
try {
number = Integer.valueOf(sysPropDomainValue);
} catch (NumberFormatException nfe) {
// ignored
}
if (number > 0) {
defaultDomainValue = number; // this one is in ms
} else {
ControllerLogger.MGMT_OP_LOGGER.invalidDefaultBlockingTimeout(sysPropDomainValue, DOMAIN_TEST_SYSTEM_PROPERTY, DEFAULT_DOMAIN_TIMEOUT_ADDER);
defaultDomainValue = DEFAULT_DOMAIN_TIMEOUT_ADDER;
}
}
return defaultDomainValue;
} | [
"private",
"static",
"int",
"resolveDomainTimeoutAdder",
"(",
")",
"{",
"String",
"propValue",
"=",
"WildFlySecurityManager",
".",
"getPropertyPrivileged",
"(",
"DOMAIN_TEST_SYSTEM_PROPERTY",
",",
"DEFAULT_DOMAIN_TIMEOUT_STRING",
")",
";",
"if",
"(",
"sysPropDomainValue",
... | Allows testsuites to shorten the domain timeout adder | [
"Allows",
"testsuites",
"to",
"shorten",
"the",
"domain",
"timeout",
"adder"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/BlockingTimeoutImpl.java#L93-L113 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java | TransformerRegistry.getDomainRegistration | public TransformersSubRegistration getDomainRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS;
return new TransformersSubRegistrationImpl(range, domain, address);
} | java | public TransformersSubRegistration getDomainRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS;
return new TransformersSubRegistrationImpl(range, domain, address);
} | [
"public",
"TransformersSubRegistration",
"getDomainRegistration",
"(",
"final",
"ModelVersionRange",
"range",
")",
"{",
"final",
"PathAddress",
"address",
"=",
"PathAddress",
".",
"EMPTY_ADDRESS",
";",
"return",
"new",
"TransformersSubRegistrationImpl",
"(",
"range",
",",... | Get the sub registry for the domain.
@param range the version range
@return the sub registry | [
"Get",
"the",
"sub",
"registry",
"for",
"the",
"domain",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L163-L166 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java | TransformerRegistry.getHostRegistration | public TransformersSubRegistration getHostRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST);
return new TransformersSubRegistrationImpl(range, domain, address);
} | java | public TransformersSubRegistration getHostRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST);
return new TransformersSubRegistrationImpl(range, domain, address);
} | [
"public",
"TransformersSubRegistration",
"getHostRegistration",
"(",
"final",
"ModelVersionRange",
"range",
")",
"{",
"final",
"PathAddress",
"address",
"=",
"PathAddress",
".",
"EMPTY_ADDRESS",
".",
"append",
"(",
"HOST",
")",
";",
"return",
"new",
"TransformersSubRe... | Get the sub registry for the hosts.
@param range the version range
@return the sub registry | [
"Get",
"the",
"sub",
"registry",
"for",
"the",
"hosts",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L174-L177 | train |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java | TransformerRegistry.getServerRegistration | public TransformersSubRegistration getServerRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST, SERVER);
return new TransformersSubRegistrationImpl(range, domain, address);
} | java | public TransformersSubRegistration getServerRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST, SERVER);
return new TransformersSubRegistrationImpl(range, domain, address);
} | [
"public",
"TransformersSubRegistration",
"getServerRegistration",
"(",
"final",
"ModelVersionRange",
"range",
")",
"{",
"final",
"PathAddress",
"address",
"=",
"PathAddress",
".",
"EMPTY_ADDRESS",
".",
"append",
"(",
"HOST",
",",
"SERVER",
")",
";",
"return",
"new",... | Get the sub registry for the servers.
@param range the version range
@return the sub registry | [
"Get",
"the",
"sub",
"registry",
"for",
"the",
"servers",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L185-L188 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.