id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
158,900
|
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
|
158,901
|
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 [\"configuration\" => \"endpoint\"]:\n Different 'default' for attribute 'sasl-protocol'. Current: \"remote\"; legacy: \"remoting\" ## both are valid also for legacy servers\n --- Problems for relative address to root [\"connector\" => \"*\"]:\n Missing attributes in current: []; missing in legacy [sasl-authentication-factory, ssl-context]\n Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory, ssl-context]\n --- Problems for relative address to root [\"http-connector\" => \"*\"]:\n Missing attributes in current: []; missing in legacy [sasl-authentication-factory]\n Missing parameters for operation 'add' in current: []; missing in legacy [sasl-authentication-factory]\n --- Problems for relative address to root [\"remote-outbound-connection\" => \"*\"]:\n Missing attributes in current: []; missing in legacy [authentication-context]\n Different 'alternatives' for attribute 'protocol'. Current: [\"authentication-context\"]; legacy: undefined\n Different 'alternatives' for attribute 'security-realm'. Current: [\"authentication-context\"]; legacy: undefined\n Different 'alternatives' for attribute 'username'. Current: [\"authentication-context\"]; legacy: undefined\n Missing parameters for operation 'add' in current: []; missing in legacy [authentication-context]\n Different 'alternatives' for parameter 'protocol' of operation 'add'. Current: [\"authentication-context\"]; legacy: undefined\n Different 'alternatives' for parameter 'security-realm' of operation 'add'. Current: [\"authentication-context\"]; legacy: undefined\n Different 'alternatives' for parameter 'username' of operation 'add'. Current: [\"authentication-context\"]; legacy: undefined\n */",
"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",
")",
";",
"}"
] |
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
|
158,902
|
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",
"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",
"(",
")",
";",
"}"
] |
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
|
158,903
|
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",
")",
"{",
"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",
";",
"}",
"}",
"}",
"}"
] |
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
|
158,904
|
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",
".",
"RELOADING",
")",
";",
"}"
] |
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
|
158,905
|
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",
".",
"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",
"(",
")",
";",
"}"
] |
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
|
158,906
|
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",
"=",
"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",
")",
";",
"}",
"}",
"}"
] |
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
|
158,907
|
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",
";",
"this",
".",
"requiredState",
"=",
"InternalState",
".",
"SERVER_STARTED",
";",
"ROOT_LOGGER",
".",
"reconnectingServer",
"(",
"serverName",
")",
";",
"internalSetState",
"(",
"new",
"ReconnectTask",
"(",
")",
",",
"InternalState",
".",
"STOPPED",
",",
"InternalState",
".",
"SEND_STDIN",
")",
";",
"}",
"}"
] |
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
|
158,908
|
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",
".",
"PROCESS_REMOVING",
")",
";",
"}"
] |
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
|
158,909
|
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
|
158,910
|
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",
"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",
";",
"}",
"}",
"}",
"}"
] |
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
|
158,911
|
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",
".",
"ROOT_LOGGER",
".",
"managedServerUnstable",
"(",
"serverName",
")",
";",
"}",
"return",
"change",
";",
"}"
] |
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
|
158,912
|
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 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",
";",
"}",
"}",
"}"
] |
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
|
158,913
|
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",
"(",
"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",
")",
";",
"}",
"}",
"}"
] |
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
|
158,914
|
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",
"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",
"(",
")",
";",
"}",
"}"
] |
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
|
158,915
|
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
|
158,916
|
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",
")",
"{",
"resourceRegistration",
".",
"registerCapability",
"(",
"c",
")",
";",
"}",
"}",
"if",
"(",
"incorporatingCapabilities",
"!=",
"null",
")",
"{",
"resourceRegistration",
".",
"registerIncorporatingCapabilities",
"(",
"incorporatingCapabilities",
")",
";",
"}",
"assert",
"requirements",
"!=",
"null",
";",
"resourceRegistration",
".",
"registerRequirements",
"(",
"requirements",
")",
";",
"}"
] |
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
|
158,917
|
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",
"...",
"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",
")",
";",
"}",
"}"
] |
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
|
158,918
|
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",
".",
"getVersion",
"(",
")",
")",
";",
"final",
"MessageOutputStream",
"output",
"=",
"channel",
".",
"writeMessage",
"(",
")",
";",
"try",
"{",
"writeHeader",
"(",
"response",
",",
"output",
")",
";",
"output",
".",
"close",
"(",
")",
";",
"}",
"finally",
"{",
"StreamUtils",
".",
"safeClose",
"(",
"output",
")",
";",
"}",
"}"
] |
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
|
158,919
|
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",
"does",
"not",
"contain",
"any",
"expression",
"the",
"input",
"is",
"returned",
"as",
"is",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/util/CLIExpressionResolver.java#L79-L85
|
158,920
|
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",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"}"
] |
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
|
158,921
|
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",
".",
"exists",
"(",
")",
")",
"{",
"return",
"new",
"LayersConfig",
"(",
")",
";",
"}",
"final",
"Properties",
"properties",
"=",
"PatchUtils",
".",
"loadProperties",
"(",
"layersList",
")",
";",
"return",
"new",
"LayersConfig",
"(",
"properties",
")",
";",
"}"
] |
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
|
158,922
|
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",
"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",
";",
"}"
] |
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",
"attributes",
"becoming",
"optional",
"-",
"this",
"method",
"also",
"indicates",
"if",
"discovery",
"options",
"are",
"required",
"where",
"the",
"host",
"and",
"port",
"were",
"not",
"supplied",
"."
] |
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
|
158,923
|
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",
")",
"{",
"return",
"new",
"RemoteProxyController",
"(",
"client",
",",
"pathAddress",
",",
"addressTranslator",
",",
"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
|
158,924
|
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",
"TransactionalProtocolClient",
"client",
"=",
"TransactionalProtocolHandlers",
".",
"createClient",
"(",
"channelAssociation",
")",
";",
"// the remote proxy",
"return",
"create",
"(",
"client",
",",
"pathAddress",
",",
"addressTranslator",
",",
"ModelVersion",
".",
"CURRENT",
")",
";",
"}"
] |
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
|
158,925
|
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
|
158,926
|
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",
"[",
"]",
"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",
"(",
")",
";",
"}",
"}"
] |
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
|
158,927
|
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",
")",
";",
"}",
"else",
"{",
"baseNCodec",
".",
"decode",
"(",
"singleByte",
",",
"0",
",",
"EOF",
",",
"context",
")",
";",
"}",
"flush",
"(",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}"
] |
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
|
158,928
|
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",
"=",
"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",
";",
"}"
] |
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
|
158,929
|
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",
"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",
")",
";",
"}",
"}"
] |
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
|
158,930
|
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",
"(",
"\"${\"",
")",
"&&",
"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",
";",
"}"
] |
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
|
158,931
|
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",
".",
"getLocation",
"(",
")",
")",
";",
"}"
] |
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
|
158,932
|
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",
"(",
"index",
")",
",",
"reader",
".",
"getLocation",
"(",
")",
")",
";",
"}"
] |
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
|
158,933
|
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",
"(",
"!",
"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",
";",
"}"
] |
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
|
158,934
|
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",
"{",
"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",
";",
"}"
] |
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
|
158,935
|
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",
"{",
"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",
";",
"}"
] |
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
|
158,936
|
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",
"{",
"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",
";",
"}"
] |
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
|
158,937
|
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",
",",
"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",
";",
"}"
] |
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
|
158,938
|
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",
"resourceRoot",
":",
"DeploymentUtils",
".",
"allResourceRoots",
"(",
"deploymentUnit",
")",
")",
"{",
"ResourceRootIndexer",
".",
"indexResourceRoot",
"(",
"resourceRoot",
")",
";",
"}",
"}"
] |
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",
"unit",
"context",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/annotation/AnnotationIndexProcessor.java#L48-L53
|
158,939
|
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",
"f",
";",
"}"
] |
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
|
158,940
|
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",
"=",
"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",
")",
";",
"}"
] |
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
|
158,941
|
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",
")",
"{",
"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",
"(",
")",
";",
"}"
] |
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
|
158,942
|
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",
")",
".",
"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",
")",
";",
"}",
"}"
] |
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
|
158,943
|
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",
"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",
";",
"}"
] |
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
|
158,944
|
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",
"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",
")",
";",
"}",
"}"
] |
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
|
158,945
|
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",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
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
|
158,946
|
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",
".",
"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",
";",
"}"
] |
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
|
158,947
|
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",
"==",
"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",
";",
"}"
] |
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
|
158,948
|
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",
",",
"domain",
",",
"address",
")",
";",
"}"
] |
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
|
158,949
|
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",
"TransformersSubRegistrationImpl",
"(",
"range",
",",
"domain",
",",
"address",
")",
";",
"}"
] |
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
|
158,950
|
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",
"TransformersSubRegistrationImpl",
"(",
"range",
",",
"domain",
",",
"address",
")",
";",
"}"
] |
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
|
158,951
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java
|
TransformerRegistry.resolveServer
|
public OperationTransformerRegistry resolveServer(final ModelVersion mgmtVersion, final ModelNode subsystems) {
return resolveServer(mgmtVersion, resolveVersions(subsystems));
}
|
java
|
public OperationTransformerRegistry resolveServer(final ModelVersion mgmtVersion, final ModelNode subsystems) {
return resolveServer(mgmtVersion, resolveVersions(subsystems));
}
|
[
"public",
"OperationTransformerRegistry",
"resolveServer",
"(",
"final",
"ModelVersion",
"mgmtVersion",
",",
"final",
"ModelNode",
"subsystems",
")",
"{",
"return",
"resolveServer",
"(",
"mgmtVersion",
",",
"resolveVersions",
"(",
"subsystems",
")",
")",
";",
"}"
] |
Resolve the server registry.
@param mgmtVersion the mgmt version
@param subsystems the subsystems
@return the transformer registry
|
[
"Resolve",
"the",
"server",
"registry",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L224-L226
|
158,952
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java
|
TransformerRegistry.addSubsystem
|
void addSubsystem(final OperationTransformerRegistry registry, final String name, final ModelVersion version) {
final OperationTransformerRegistry profile = registry.getChild(PathAddress.pathAddress(PROFILE));
final OperationTransformerRegistry server = registry.getChild(PathAddress.pathAddress(HOST, SERVER));
final PathAddress address = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, name));
subsystem.mergeSubtree(profile, Collections.singletonMap(address, version));
if(server != null) {
subsystem.mergeSubtree(server, Collections.singletonMap(address, version));
}
}
|
java
|
void addSubsystem(final OperationTransformerRegistry registry, final String name, final ModelVersion version) {
final OperationTransformerRegistry profile = registry.getChild(PathAddress.pathAddress(PROFILE));
final OperationTransformerRegistry server = registry.getChild(PathAddress.pathAddress(HOST, SERVER));
final PathAddress address = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, name));
subsystem.mergeSubtree(profile, Collections.singletonMap(address, version));
if(server != null) {
subsystem.mergeSubtree(server, Collections.singletonMap(address, version));
}
}
|
[
"void",
"addSubsystem",
"(",
"final",
"OperationTransformerRegistry",
"registry",
",",
"final",
"String",
"name",
",",
"final",
"ModelVersion",
"version",
")",
"{",
"final",
"OperationTransformerRegistry",
"profile",
"=",
"registry",
".",
"getChild",
"(",
"PathAddress",
".",
"pathAddress",
"(",
"PROFILE",
")",
")",
";",
"final",
"OperationTransformerRegistry",
"server",
"=",
"registry",
".",
"getChild",
"(",
"PathAddress",
".",
"pathAddress",
"(",
"HOST",
",",
"SERVER",
")",
")",
";",
"final",
"PathAddress",
"address",
"=",
"PathAddress",
".",
"pathAddress",
"(",
"PathElement",
".",
"pathElement",
"(",
"ModelDescriptionConstants",
".",
"SUBSYSTEM",
",",
"name",
")",
")",
";",
"subsystem",
".",
"mergeSubtree",
"(",
"profile",
",",
"Collections",
".",
"singletonMap",
"(",
"address",
",",
"version",
")",
")",
";",
"if",
"(",
"server",
"!=",
"null",
")",
"{",
"subsystem",
".",
"mergeSubtree",
"(",
"server",
",",
"Collections",
".",
"singletonMap",
"(",
"address",
",",
"version",
")",
")",
";",
"}",
"}"
] |
Add a new subsystem to a given registry.
@param registry the registry
@param name the subsystem name
@param version the version
|
[
"Add",
"a",
"new",
"subsystem",
"to",
"a",
"given",
"registry",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformerRegistry.java#L248-L256
|
158,953
|
wildfly/wildfly-core
|
domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java
|
PropertiesFileLoader.persistProperties
|
public synchronized void persistProperties() throws IOException {
beginPersistence();
// Read the properties file into memory
// Shouldn't be so bad - it's a small file
List<String> content = readFile(propertiesFile);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propertiesFile), StandardCharsets.UTF_8));
try {
for (String line : content) {
String trimmed = line.trim();
if (trimmed.length() == 0) {
bw.newLine();
} else {
Matcher matcher = PROPERTY_PATTERN.matcher(trimmed);
if (matcher.matches()) {
final String key = cleanKey(matcher.group(1));
if (toSave.containsKey(key) || toSave.containsKey(key + DISABLE_SUFFIX_KEY)) {
writeProperty(bw, key, matcher.group(2));
toSave.remove(key);
toSave.remove(key + DISABLE_SUFFIX_KEY);
} else if (trimmed.startsWith(COMMENT_PREFIX)) {
// disabled user
write(bw, line, true);
}
} else {
write(bw, line, true);
}
}
}
endPersistence(bw);
} finally {
safeClose(bw);
}
}
|
java
|
public synchronized void persistProperties() throws IOException {
beginPersistence();
// Read the properties file into memory
// Shouldn't be so bad - it's a small file
List<String> content = readFile(propertiesFile);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propertiesFile), StandardCharsets.UTF_8));
try {
for (String line : content) {
String trimmed = line.trim();
if (trimmed.length() == 0) {
bw.newLine();
} else {
Matcher matcher = PROPERTY_PATTERN.matcher(trimmed);
if (matcher.matches()) {
final String key = cleanKey(matcher.group(1));
if (toSave.containsKey(key) || toSave.containsKey(key + DISABLE_SUFFIX_KEY)) {
writeProperty(bw, key, matcher.group(2));
toSave.remove(key);
toSave.remove(key + DISABLE_SUFFIX_KEY);
} else if (trimmed.startsWith(COMMENT_PREFIX)) {
// disabled user
write(bw, line, true);
}
} else {
write(bw, line, true);
}
}
}
endPersistence(bw);
} finally {
safeClose(bw);
}
}
|
[
"public",
"synchronized",
"void",
"persistProperties",
"(",
")",
"throws",
"IOException",
"{",
"beginPersistence",
"(",
")",
";",
"// Read the properties file into memory",
"// Shouldn't be so bad - it's a small file",
"List",
"<",
"String",
">",
"content",
"=",
"readFile",
"(",
"propertiesFile",
")",
";",
"BufferedWriter",
"bw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"new",
"FileOutputStream",
"(",
"propertiesFile",
")",
",",
"StandardCharsets",
".",
"UTF_8",
")",
")",
";",
"try",
"{",
"for",
"(",
"String",
"line",
":",
"content",
")",
"{",
"String",
"trimmed",
"=",
"line",
".",
"trim",
"(",
")",
";",
"if",
"(",
"trimmed",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"bw",
".",
"newLine",
"(",
")",
";",
"}",
"else",
"{",
"Matcher",
"matcher",
"=",
"PROPERTY_PATTERN",
".",
"matcher",
"(",
"trimmed",
")",
";",
"if",
"(",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"final",
"String",
"key",
"=",
"cleanKey",
"(",
"matcher",
".",
"group",
"(",
"1",
")",
")",
";",
"if",
"(",
"toSave",
".",
"containsKey",
"(",
"key",
")",
"||",
"toSave",
".",
"containsKey",
"(",
"key",
"+",
"DISABLE_SUFFIX_KEY",
")",
")",
"{",
"writeProperty",
"(",
"bw",
",",
"key",
",",
"matcher",
".",
"group",
"(",
"2",
")",
")",
";",
"toSave",
".",
"remove",
"(",
"key",
")",
";",
"toSave",
".",
"remove",
"(",
"key",
"+",
"DISABLE_SUFFIX_KEY",
")",
";",
"}",
"else",
"if",
"(",
"trimmed",
".",
"startsWith",
"(",
"COMMENT_PREFIX",
")",
")",
"{",
"// disabled user",
"write",
"(",
"bw",
",",
"line",
",",
"true",
")",
";",
"}",
"}",
"else",
"{",
"write",
"(",
"bw",
",",
"line",
",",
"true",
")",
";",
"}",
"}",
"}",
"endPersistence",
"(",
"bw",
")",
";",
"}",
"finally",
"{",
"safeClose",
"(",
"bw",
")",
";",
"}",
"}"
] |
Saves changes in properties file. It reads the property file into memory, modifies it and saves it back to the file.
@throws IOException
|
[
"Saves",
"changes",
"in",
"properties",
"file",
".",
"It",
"reads",
"the",
"property",
"file",
"into",
"memory",
"modifies",
"it",
"and",
"saves",
"it",
"back",
"to",
"the",
"file",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java#L216-L252
|
158,954
|
wildfly/wildfly-core
|
domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java
|
PropertiesFileLoader.addLineContent
|
protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException {
content.add(line);
}
|
java
|
protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException {
content.add(line);
}
|
[
"protected",
"void",
"addLineContent",
"(",
"BufferedReader",
"bufferedFileReader",
",",
"List",
"<",
"String",
">",
"content",
",",
"String",
"line",
")",
"throws",
"IOException",
"{",
"content",
".",
"add",
"(",
"line",
")",
";",
"}"
] |
Add the line to the content
@param bufferedFileReader The file reader
@param content The content of the file
@param line The current read line
@throws IOException
|
[
"Add",
"the",
"line",
"to",
"the",
"content"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java#L301-L303
|
158,955
|
wildfly/wildfly-core
|
domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java
|
PropertiesFileLoader.endPersistence
|
protected void endPersistence(final BufferedWriter writer) throws IOException {
// Append any additional users to the end of the file.
for (Object currentKey : toSave.keySet()) {
String key = (String) currentKey;
if (!key.contains(DISABLE_SUFFIX_KEY)) {
writeProperty(writer, key, null);
}
}
toSave = null;
}
|
java
|
protected void endPersistence(final BufferedWriter writer) throws IOException {
// Append any additional users to the end of the file.
for (Object currentKey : toSave.keySet()) {
String key = (String) currentKey;
if (!key.contains(DISABLE_SUFFIX_KEY)) {
writeProperty(writer, key, null);
}
}
toSave = null;
}
|
[
"protected",
"void",
"endPersistence",
"(",
"final",
"BufferedWriter",
"writer",
")",
"throws",
"IOException",
"{",
"// Append any additional users to the end of the file.",
"for",
"(",
"Object",
"currentKey",
":",
"toSave",
".",
"keySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"(",
"String",
")",
"currentKey",
";",
"if",
"(",
"!",
"key",
".",
"contains",
"(",
"DISABLE_SUFFIX_KEY",
")",
")",
"{",
"writeProperty",
"(",
"writer",
",",
"key",
",",
"null",
")",
";",
"}",
"}",
"toSave",
"=",
"null",
";",
"}"
] |
Method called to indicate persisting the properties file is now complete.
@throws IOException
|
[
"Method",
"called",
"to",
"indicate",
"persisting",
"the",
"properties",
"file",
"is",
"now",
"complete",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java#L326-L336
|
158,956
|
wildfly/wildfly-core
|
server/src/main/java/org/jboss/as/server/deployment/ServicesAttachment.java
|
ServicesAttachment.getServiceImplementations
|
public List<String> getServiceImplementations(String serviceTypeName) {
final List<String> strings = services.get(serviceTypeName);
return strings == null ? Collections.<String>emptyList() : Collections.unmodifiableList(strings);
}
|
java
|
public List<String> getServiceImplementations(String serviceTypeName) {
final List<String> strings = services.get(serviceTypeName);
return strings == null ? Collections.<String>emptyList() : Collections.unmodifiableList(strings);
}
|
[
"public",
"List",
"<",
"String",
">",
"getServiceImplementations",
"(",
"String",
"serviceTypeName",
")",
"{",
"final",
"List",
"<",
"String",
">",
"strings",
"=",
"services",
".",
"get",
"(",
"serviceTypeName",
")",
";",
"return",
"strings",
"==",
"null",
"?",
"Collections",
".",
"<",
"String",
">",
"emptyList",
"(",
")",
":",
"Collections",
".",
"unmodifiableList",
"(",
"strings",
")",
";",
"}"
] |
Get the service implementations for a given type name.
@param serviceTypeName the type name
@return the possibly empty list of services
|
[
"Get",
"the",
"service",
"implementations",
"for",
"a",
"given",
"type",
"name",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/ServicesAttachment.java#L48-L51
|
158,957
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/embedded/EmbeddedLogContext.java
|
EmbeddedLogContext.configureLogContext
|
static synchronized LogContext configureLogContext(final File logDir, final File configDir, final String defaultLogFileName, final CommandContext ctx) {
final LogContext embeddedLogContext = Holder.LOG_CONTEXT;
final Path bootLog = logDir.toPath().resolve(Paths.get(defaultLogFileName));
final Path loggingProperties = configDir.toPath().resolve(Paths.get("logging.properties"));
if (Files.exists(loggingProperties)) {
WildFlySecurityManager.setPropertyPrivileged("org.jboss.boot.log.file", bootLog.toAbsolutePath().toString());
try (final InputStream in = Files.newInputStream(loggingProperties)) {
// Attempt to get the configurator from the root logger
Configurator configurator = embeddedLogContext.getAttachment("", Configurator.ATTACHMENT_KEY);
if (configurator == null) {
configurator = new PropertyConfigurator(embeddedLogContext);
final Configurator existing = embeddedLogContext.getLogger("").attachIfAbsent(Configurator.ATTACHMENT_KEY, configurator);
if (existing != null) {
configurator = existing;
}
}
configurator.configure(in);
} catch (IOException e) {
ctx.printLine(String.format("Unable to configure logging from configuration file %s. Reason: %s", loggingProperties, e.getLocalizedMessage()));
}
}
return embeddedLogContext;
}
|
java
|
static synchronized LogContext configureLogContext(final File logDir, final File configDir, final String defaultLogFileName, final CommandContext ctx) {
final LogContext embeddedLogContext = Holder.LOG_CONTEXT;
final Path bootLog = logDir.toPath().resolve(Paths.get(defaultLogFileName));
final Path loggingProperties = configDir.toPath().resolve(Paths.get("logging.properties"));
if (Files.exists(loggingProperties)) {
WildFlySecurityManager.setPropertyPrivileged("org.jboss.boot.log.file", bootLog.toAbsolutePath().toString());
try (final InputStream in = Files.newInputStream(loggingProperties)) {
// Attempt to get the configurator from the root logger
Configurator configurator = embeddedLogContext.getAttachment("", Configurator.ATTACHMENT_KEY);
if (configurator == null) {
configurator = new PropertyConfigurator(embeddedLogContext);
final Configurator existing = embeddedLogContext.getLogger("").attachIfAbsent(Configurator.ATTACHMENT_KEY, configurator);
if (existing != null) {
configurator = existing;
}
}
configurator.configure(in);
} catch (IOException e) {
ctx.printLine(String.format("Unable to configure logging from configuration file %s. Reason: %s", loggingProperties, e.getLocalizedMessage()));
}
}
return embeddedLogContext;
}
|
[
"static",
"synchronized",
"LogContext",
"configureLogContext",
"(",
"final",
"File",
"logDir",
",",
"final",
"File",
"configDir",
",",
"final",
"String",
"defaultLogFileName",
",",
"final",
"CommandContext",
"ctx",
")",
"{",
"final",
"LogContext",
"embeddedLogContext",
"=",
"Holder",
".",
"LOG_CONTEXT",
";",
"final",
"Path",
"bootLog",
"=",
"logDir",
".",
"toPath",
"(",
")",
".",
"resolve",
"(",
"Paths",
".",
"get",
"(",
"defaultLogFileName",
")",
")",
";",
"final",
"Path",
"loggingProperties",
"=",
"configDir",
".",
"toPath",
"(",
")",
".",
"resolve",
"(",
"Paths",
".",
"get",
"(",
"\"logging.properties\"",
")",
")",
";",
"if",
"(",
"Files",
".",
"exists",
"(",
"loggingProperties",
")",
")",
"{",
"WildFlySecurityManager",
".",
"setPropertyPrivileged",
"(",
"\"org.jboss.boot.log.file\"",
",",
"bootLog",
".",
"toAbsolutePath",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"try",
"(",
"final",
"InputStream",
"in",
"=",
"Files",
".",
"newInputStream",
"(",
"loggingProperties",
")",
")",
"{",
"// Attempt to get the configurator from the root logger",
"Configurator",
"configurator",
"=",
"embeddedLogContext",
".",
"getAttachment",
"(",
"\"\"",
",",
"Configurator",
".",
"ATTACHMENT_KEY",
")",
";",
"if",
"(",
"configurator",
"==",
"null",
")",
"{",
"configurator",
"=",
"new",
"PropertyConfigurator",
"(",
"embeddedLogContext",
")",
";",
"final",
"Configurator",
"existing",
"=",
"embeddedLogContext",
".",
"getLogger",
"(",
"\"\"",
")",
".",
"attachIfAbsent",
"(",
"Configurator",
".",
"ATTACHMENT_KEY",
",",
"configurator",
")",
";",
"if",
"(",
"existing",
"!=",
"null",
")",
"{",
"configurator",
"=",
"existing",
";",
"}",
"}",
"configurator",
".",
"configure",
"(",
"in",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ctx",
".",
"printLine",
"(",
"String",
".",
"format",
"(",
"\"Unable to configure logging from configuration file %s. Reason: %s\"",
",",
"loggingProperties",
",",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"embeddedLogContext",
";",
"}"
] |
Configures the log context for the server and returns the configured log context.
@param logDir the logging directory, from jboss.server|domain.log.dir standalone default {@code $JBOSS_HOME/standalone/log}
@param configDir the configuration directory from jboss.server|domain.config.dir, standalone default {@code $JBOSS_HOME/standalone/configuration}
@param defaultLogFileName the name of the log file to pass to {@code org.jboss.boot.log.file}
@param ctx the command context used to report errors to
@return the configured log context
|
[
"Configures",
"the",
"log",
"context",
"for",
"the",
"server",
"and",
"returns",
"the",
"configured",
"log",
"context",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/embedded/EmbeddedLogContext.java#L65-L88
|
158,958
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/embedded/EmbeddedLogContext.java
|
EmbeddedLogContext.clearLogContext
|
static synchronized void clearLogContext() {
final LogContext embeddedLogContext = Holder.LOG_CONTEXT;
// Remove the configurator and clear the log context
final Configurator configurator = embeddedLogContext.getLogger("").detach(Configurator.ATTACHMENT_KEY);
// If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext
if (configurator instanceof PropertyConfigurator) {
final LogContextConfiguration logContextConfiguration = ((PropertyConfigurator) configurator).getLogContextConfiguration();
clearLogContext(logContextConfiguration);
} else if (configurator instanceof LogContextConfiguration) {
clearLogContext((LogContextConfiguration) configurator);
} else {
// Remove all the handlers and close them as well as reset the loggers
final List<String> loggerNames = Collections.list(embeddedLogContext.getLoggerNames());
for (String name : loggerNames) {
final Logger logger = embeddedLogContext.getLoggerIfExists(name);
if (logger != null) {
final Handler[] handlers = logger.clearHandlers();
if (handlers != null) {
for (Handler handler : handlers) {
handler.close();
}
}
logger.setFilter(null);
logger.setUseParentFilters(false);
logger.setUseParentHandlers(true);
logger.setLevel(Level.INFO);
}
}
}
}
|
java
|
static synchronized void clearLogContext() {
final LogContext embeddedLogContext = Holder.LOG_CONTEXT;
// Remove the configurator and clear the log context
final Configurator configurator = embeddedLogContext.getLogger("").detach(Configurator.ATTACHMENT_KEY);
// If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext
if (configurator instanceof PropertyConfigurator) {
final LogContextConfiguration logContextConfiguration = ((PropertyConfigurator) configurator).getLogContextConfiguration();
clearLogContext(logContextConfiguration);
} else if (configurator instanceof LogContextConfiguration) {
clearLogContext((LogContextConfiguration) configurator);
} else {
// Remove all the handlers and close them as well as reset the loggers
final List<String> loggerNames = Collections.list(embeddedLogContext.getLoggerNames());
for (String name : loggerNames) {
final Logger logger = embeddedLogContext.getLoggerIfExists(name);
if (logger != null) {
final Handler[] handlers = logger.clearHandlers();
if (handlers != null) {
for (Handler handler : handlers) {
handler.close();
}
}
logger.setFilter(null);
logger.setUseParentFilters(false);
logger.setUseParentHandlers(true);
logger.setLevel(Level.INFO);
}
}
}
}
|
[
"static",
"synchronized",
"void",
"clearLogContext",
"(",
")",
"{",
"final",
"LogContext",
"embeddedLogContext",
"=",
"Holder",
".",
"LOG_CONTEXT",
";",
"// Remove the configurator and clear the log context",
"final",
"Configurator",
"configurator",
"=",
"embeddedLogContext",
".",
"getLogger",
"(",
"\"\"",
")",
".",
"detach",
"(",
"Configurator",
".",
"ATTACHMENT_KEY",
")",
";",
"// If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext",
"if",
"(",
"configurator",
"instanceof",
"PropertyConfigurator",
")",
"{",
"final",
"LogContextConfiguration",
"logContextConfiguration",
"=",
"(",
"(",
"PropertyConfigurator",
")",
"configurator",
")",
".",
"getLogContextConfiguration",
"(",
")",
";",
"clearLogContext",
"(",
"logContextConfiguration",
")",
";",
"}",
"else",
"if",
"(",
"configurator",
"instanceof",
"LogContextConfiguration",
")",
"{",
"clearLogContext",
"(",
"(",
"LogContextConfiguration",
")",
"configurator",
")",
";",
"}",
"else",
"{",
"// Remove all the handlers and close them as well as reset the loggers",
"final",
"List",
"<",
"String",
">",
"loggerNames",
"=",
"Collections",
".",
"list",
"(",
"embeddedLogContext",
".",
"getLoggerNames",
"(",
")",
")",
";",
"for",
"(",
"String",
"name",
":",
"loggerNames",
")",
"{",
"final",
"Logger",
"logger",
"=",
"embeddedLogContext",
".",
"getLoggerIfExists",
"(",
"name",
")",
";",
"if",
"(",
"logger",
"!=",
"null",
")",
"{",
"final",
"Handler",
"[",
"]",
"handlers",
"=",
"logger",
".",
"clearHandlers",
"(",
")",
";",
"if",
"(",
"handlers",
"!=",
"null",
")",
"{",
"for",
"(",
"Handler",
"handler",
":",
"handlers",
")",
"{",
"handler",
".",
"close",
"(",
")",
";",
"}",
"}",
"logger",
".",
"setFilter",
"(",
"null",
")",
";",
"logger",
".",
"setUseParentFilters",
"(",
"false",
")",
";",
"logger",
".",
"setUseParentHandlers",
"(",
"true",
")",
";",
"logger",
".",
"setLevel",
"(",
"Level",
".",
"INFO",
")",
";",
"}",
"}",
"}",
"}"
] |
Attempts to clear the global log context used for embedded servers.
|
[
"Attempts",
"to",
"clear",
"the",
"global",
"log",
"context",
"used",
"for",
"embedded",
"servers",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/embedded/EmbeddedLogContext.java#L93-L122
|
158,959
|
wildfly/wildfly-core
|
domain-http/interface/src/main/java/org/jboss/as/domain/http/server/cors/CorsUtil.java
|
CorsUtil.matchOrigin
|
public static String matchOrigin(HttpServerExchange exchange, Collection<String> allowedOrigins) throws Exception {
HeaderMap headers = exchange.getRequestHeaders();
String[] origins = headers.get(Headers.ORIGIN).toArray();
if (allowedOrigins != null && !allowedOrigins.isEmpty()) {
for (String allowedOrigin : allowedOrigins) {
for (String origin : origins) {
if (allowedOrigin.equalsIgnoreCase(sanitizeDefaultPort(origin))) {
return allowedOrigin;
}
}
}
}
String allowedOrigin = defaultOrigin(exchange);
for (String origin : origins) {
if (allowedOrigin.equalsIgnoreCase(sanitizeDefaultPort(origin))) {
return allowedOrigin;
}
}
ROOT_LOGGER.debug("Request rejected due to HOST/ORIGIN mis-match.");
ResponseCodeHandler.HANDLE_403.handleRequest(exchange);
return null;
}
|
java
|
public static String matchOrigin(HttpServerExchange exchange, Collection<String> allowedOrigins) throws Exception {
HeaderMap headers = exchange.getRequestHeaders();
String[] origins = headers.get(Headers.ORIGIN).toArray();
if (allowedOrigins != null && !allowedOrigins.isEmpty()) {
for (String allowedOrigin : allowedOrigins) {
for (String origin : origins) {
if (allowedOrigin.equalsIgnoreCase(sanitizeDefaultPort(origin))) {
return allowedOrigin;
}
}
}
}
String allowedOrigin = defaultOrigin(exchange);
for (String origin : origins) {
if (allowedOrigin.equalsIgnoreCase(sanitizeDefaultPort(origin))) {
return allowedOrigin;
}
}
ROOT_LOGGER.debug("Request rejected due to HOST/ORIGIN mis-match.");
ResponseCodeHandler.HANDLE_403.handleRequest(exchange);
return null;
}
|
[
"public",
"static",
"String",
"matchOrigin",
"(",
"HttpServerExchange",
"exchange",
",",
"Collection",
"<",
"String",
">",
"allowedOrigins",
")",
"throws",
"Exception",
"{",
"HeaderMap",
"headers",
"=",
"exchange",
".",
"getRequestHeaders",
"(",
")",
";",
"String",
"[",
"]",
"origins",
"=",
"headers",
".",
"get",
"(",
"Headers",
".",
"ORIGIN",
")",
".",
"toArray",
"(",
")",
";",
"if",
"(",
"allowedOrigins",
"!=",
"null",
"&&",
"!",
"allowedOrigins",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"String",
"allowedOrigin",
":",
"allowedOrigins",
")",
"{",
"for",
"(",
"String",
"origin",
":",
"origins",
")",
"{",
"if",
"(",
"allowedOrigin",
".",
"equalsIgnoreCase",
"(",
"sanitizeDefaultPort",
"(",
"origin",
")",
")",
")",
"{",
"return",
"allowedOrigin",
";",
"}",
"}",
"}",
"}",
"String",
"allowedOrigin",
"=",
"defaultOrigin",
"(",
"exchange",
")",
";",
"for",
"(",
"String",
"origin",
":",
"origins",
")",
"{",
"if",
"(",
"allowedOrigin",
".",
"equalsIgnoreCase",
"(",
"sanitizeDefaultPort",
"(",
"origin",
")",
")",
")",
"{",
"return",
"allowedOrigin",
";",
"}",
"}",
"ROOT_LOGGER",
".",
"debug",
"(",
"\"Request rejected due to HOST/ORIGIN mis-match.\"",
")",
";",
"ResponseCodeHandler",
".",
"HANDLE_403",
".",
"handleRequest",
"(",
"exchange",
")",
";",
"return",
"null",
";",
"}"
] |
Match the Origin header with the allowed origins.
If it doesn't match then a 403 response code is set on the response and it returns null.
@param exchange the current HttpExchange.
@param allowedOrigins list of sanitized allowed origins.
@return the first matching origin, null otherwise.
@throws Exception
|
[
"Match",
"the",
"Origin",
"header",
"with",
"the",
"allowed",
"origins",
".",
"If",
"it",
"doesn",
"t",
"match",
"then",
"a",
"403",
"response",
"code",
"is",
"set",
"on",
"the",
"response",
"and",
"it",
"returns",
"null",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-http/interface/src/main/java/org/jboss/as/domain/http/server/cors/CorsUtil.java#L55-L76
|
158,960
|
wildfly/wildfly-core
|
server/src/main/java/org/jboss/as/server/deployment/reflect/DeploymentReflectionIndex.java
|
DeploymentReflectionIndex.create
|
public static DeploymentReflectionIndex create() {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ServerPermission.CREATE_DEPLOYMENT_REFLECTION_INDEX);
}
return new DeploymentReflectionIndex();
}
|
java
|
public static DeploymentReflectionIndex create() {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ServerPermission.CREATE_DEPLOYMENT_REFLECTION_INDEX);
}
return new DeploymentReflectionIndex();
}
|
[
"public",
"static",
"DeploymentReflectionIndex",
"create",
"(",
")",
"{",
"final",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"null",
")",
"{",
"sm",
".",
"checkPermission",
"(",
"ServerPermission",
".",
"CREATE_DEPLOYMENT_REFLECTION_INDEX",
")",
";",
"}",
"return",
"new",
"DeploymentReflectionIndex",
"(",
")",
";",
"}"
] |
Construct a new instance.
@return the new instance
|
[
"Construct",
"a",
"new",
"instance",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/DeploymentReflectionIndex.java#L49-L55
|
158,961
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/registry/AbstractResourceRegistration.java
|
AbstractResourceRegistration.getOperationDescriptions
|
@Override
public final Map<String, OperationEntry> getOperationDescriptions(final PathAddress address, boolean inherited) {
if (parent != null) {
RootInvocation ri = getRootInvocation();
return ri.root.getOperationDescriptions(ri.pathAddress.append(address), inherited);
}
// else we are the root
Map<String, OperationEntry> providers = new TreeMap<String, OperationEntry>();
getOperationDescriptions(address.iterator(), providers, inherited);
return providers;
}
|
java
|
@Override
public final Map<String, OperationEntry> getOperationDescriptions(final PathAddress address, boolean inherited) {
if (parent != null) {
RootInvocation ri = getRootInvocation();
return ri.root.getOperationDescriptions(ri.pathAddress.append(address), inherited);
}
// else we are the root
Map<String, OperationEntry> providers = new TreeMap<String, OperationEntry>();
getOperationDescriptions(address.iterator(), providers, inherited);
return providers;
}
|
[
"@",
"Override",
"public",
"final",
"Map",
"<",
"String",
",",
"OperationEntry",
">",
"getOperationDescriptions",
"(",
"final",
"PathAddress",
"address",
",",
"boolean",
"inherited",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"RootInvocation",
"ri",
"=",
"getRootInvocation",
"(",
")",
";",
"return",
"ri",
".",
"root",
".",
"getOperationDescriptions",
"(",
"ri",
".",
"pathAddress",
".",
"append",
"(",
"address",
")",
",",
"inherited",
")",
";",
"}",
"// else we are the root",
"Map",
"<",
"String",
",",
"OperationEntry",
">",
"providers",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"OperationEntry",
">",
"(",
")",
";",
"getOperationDescriptions",
"(",
"address",
".",
"iterator",
"(",
")",
",",
"providers",
",",
"inherited",
")",
";",
"return",
"providers",
";",
"}"
] |
Get all the handlers at a specific address.
@param address the address
@param inherited true to include the inherited operations
@return the handlers
|
[
"Get",
"all",
"the",
"handlers",
"at",
"a",
"specific",
"address",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/AbstractResourceRegistration.java#L228-L239
|
158,962
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/registry/AbstractResourceRegistration.java
|
AbstractResourceRegistration.hasNoAlternativeWildcardRegistration
|
boolean hasNoAlternativeWildcardRegistration() {
return parent == null || PathElement.WILDCARD_VALUE.equals(valueString) || !parent.getChildNames().contains(PathElement.WILDCARD_VALUE);
}
|
java
|
boolean hasNoAlternativeWildcardRegistration() {
return parent == null || PathElement.WILDCARD_VALUE.equals(valueString) || !parent.getChildNames().contains(PathElement.WILDCARD_VALUE);
}
|
[
"boolean",
"hasNoAlternativeWildcardRegistration",
"(",
")",
"{",
"return",
"parent",
"==",
"null",
"||",
"PathElement",
".",
"WILDCARD_VALUE",
".",
"equals",
"(",
"valueString",
")",
"||",
"!",
"parent",
".",
"getChildNames",
"(",
")",
".",
"contains",
"(",
"PathElement",
".",
"WILDCARD_VALUE",
")",
";",
"}"
] |
Gets whether this registration has an alternative wildcard registration
|
[
"Gets",
"whether",
"this",
"registration",
"has",
"an",
"alternative",
"wildcard",
"registration"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/AbstractResourceRegistration.java#L427-L429
|
158,963
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/accesscontrol/CLIAccessControl.java
|
CLIAccessControl.getAccessControl
|
public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {
return getAccessControl(client, null, address, operations);
}
|
java
|
public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {
return getAccessControl(client, null, address, operations);
}
|
[
"public",
"static",
"ModelNode",
"getAccessControl",
"(",
"ModelControllerClient",
"client",
",",
"OperationRequestAddress",
"address",
",",
"boolean",
"operations",
")",
"{",
"return",
"getAccessControl",
"(",
"client",
",",
"null",
",",
"address",
",",
"operations",
")",
";",
"}"
] |
Executed read-resource-description and returns access-control info.
Returns null in case there was any kind of problem.
@param client
@param address
@return
|
[
"Executed",
"read",
"-",
"resource",
"-",
"description",
"and",
"returns",
"access",
"-",
"control",
"info",
".",
"Returns",
"null",
"in",
"case",
"there",
"was",
"any",
"kind",
"of",
"problem",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/accesscontrol/CLIAccessControl.java#L86-L88
|
158,964
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/impl/aesh/SynopsisGenerator.java
|
SynopsisGenerator.generateSynopsis
|
String generateSynopsis() {
synopsisOptions = buildSynopsisOptions(opts, arg, domain);
StringBuilder synopsisBuilder = new StringBuilder();
if (parentName != null) {
synopsisBuilder.append(parentName).append(" ");
}
synopsisBuilder.append(commandName);
if (isOperation && !opts.isEmpty()) {
synopsisBuilder.append("(");
} else {
synopsisBuilder.append(" ");
}
boolean hasOptions = arg != null || !opts.isEmpty();
if (hasActions && hasOptions) {
synopsisBuilder.append(" [");
}
if (hasActions) {
synopsisBuilder.append(" <action>");
}
if (hasActions && hasOptions) {
synopsisBuilder.append(" ] || [");
}
SynopsisOption opt;
while ((opt = retrieveNextOption(synopsisOptions, false)) != null) {
String content = addSynopsisOption(opt);
if (content != null) {
synopsisBuilder.append(content.trim());
if (isOperation) {
if (!synopsisOptions.isEmpty()) {
synopsisBuilder.append(",");
} else {
synopsisBuilder.append(")");
}
}
synopsisBuilder.append(" ");
}
}
if (hasActions && hasOptions) {
synopsisBuilder.append(" ]");
}
return synopsisBuilder.toString();
}
|
java
|
String generateSynopsis() {
synopsisOptions = buildSynopsisOptions(opts, arg, domain);
StringBuilder synopsisBuilder = new StringBuilder();
if (parentName != null) {
synopsisBuilder.append(parentName).append(" ");
}
synopsisBuilder.append(commandName);
if (isOperation && !opts.isEmpty()) {
synopsisBuilder.append("(");
} else {
synopsisBuilder.append(" ");
}
boolean hasOptions = arg != null || !opts.isEmpty();
if (hasActions && hasOptions) {
synopsisBuilder.append(" [");
}
if (hasActions) {
synopsisBuilder.append(" <action>");
}
if (hasActions && hasOptions) {
synopsisBuilder.append(" ] || [");
}
SynopsisOption opt;
while ((opt = retrieveNextOption(synopsisOptions, false)) != null) {
String content = addSynopsisOption(opt);
if (content != null) {
synopsisBuilder.append(content.trim());
if (isOperation) {
if (!synopsisOptions.isEmpty()) {
synopsisBuilder.append(",");
} else {
synopsisBuilder.append(")");
}
}
synopsisBuilder.append(" ");
}
}
if (hasActions && hasOptions) {
synopsisBuilder.append(" ]");
}
return synopsisBuilder.toString();
}
|
[
"String",
"generateSynopsis",
"(",
")",
"{",
"synopsisOptions",
"=",
"buildSynopsisOptions",
"(",
"opts",
",",
"arg",
",",
"domain",
")",
";",
"StringBuilder",
"synopsisBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"parentName",
"!=",
"null",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"parentName",
")",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"synopsisBuilder",
".",
"append",
"(",
"commandName",
")",
";",
"if",
"(",
"isOperation",
"&&",
"!",
"opts",
".",
"isEmpty",
"(",
")",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\"(\"",
")",
";",
"}",
"else",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"boolean",
"hasOptions",
"=",
"arg",
"!=",
"null",
"||",
"!",
"opts",
".",
"isEmpty",
"(",
")",
";",
"if",
"(",
"hasActions",
"&&",
"hasOptions",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\" [\"",
")",
";",
"}",
"if",
"(",
"hasActions",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\" <action>\"",
")",
";",
"}",
"if",
"(",
"hasActions",
"&&",
"hasOptions",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\" ] || [\"",
")",
";",
"}",
"SynopsisOption",
"opt",
";",
"while",
"(",
"(",
"opt",
"=",
"retrieveNextOption",
"(",
"synopsisOptions",
",",
"false",
")",
")",
"!=",
"null",
")",
"{",
"String",
"content",
"=",
"addSynopsisOption",
"(",
"opt",
")",
";",
"if",
"(",
"content",
"!=",
"null",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"content",
".",
"trim",
"(",
")",
")",
";",
"if",
"(",
"isOperation",
")",
"{",
"if",
"(",
"!",
"synopsisOptions",
".",
"isEmpty",
"(",
")",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\",\"",
")",
";",
"}",
"else",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\")\"",
")",
";",
"}",
"}",
"synopsisBuilder",
".",
"append",
"(",
"\" \"",
")",
";",
"}",
"}",
"if",
"(",
"hasActions",
"&&",
"hasOptions",
")",
"{",
"synopsisBuilder",
".",
"append",
"(",
"\" ]\"",
")",
";",
"}",
"return",
"synopsisBuilder",
".",
"toString",
"(",
")",
";",
"}"
] |
main class entry point.
|
[
"main",
"class",
"entry",
"point",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/impl/aesh/SynopsisGenerator.java#L82-L123
|
158,965
|
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentity.java
|
InstalledIdentity.load
|
protected static InstallationModificationImpl.InstallationState load(final InstalledIdentity installedIdentity) throws IOException {
final InstallationModificationImpl.InstallationState state = new InstallationModificationImpl.InstallationState();
for (final Layer layer : installedIdentity.getLayers()) {
state.putLayer(layer);
}
for (final AddOn addOn : installedIdentity.getAddOns()) {
state.putAddOn(addOn);
}
return state;
}
|
java
|
protected static InstallationModificationImpl.InstallationState load(final InstalledIdentity installedIdentity) throws IOException {
final InstallationModificationImpl.InstallationState state = new InstallationModificationImpl.InstallationState();
for (final Layer layer : installedIdentity.getLayers()) {
state.putLayer(layer);
}
for (final AddOn addOn : installedIdentity.getAddOns()) {
state.putAddOn(addOn);
}
return state;
}
|
[
"protected",
"static",
"InstallationModificationImpl",
".",
"InstallationState",
"load",
"(",
"final",
"InstalledIdentity",
"installedIdentity",
")",
"throws",
"IOException",
"{",
"final",
"InstallationModificationImpl",
".",
"InstallationState",
"state",
"=",
"new",
"InstallationModificationImpl",
".",
"InstallationState",
"(",
")",
";",
"for",
"(",
"final",
"Layer",
"layer",
":",
"installedIdentity",
".",
"getLayers",
"(",
")",
")",
"{",
"state",
".",
"putLayer",
"(",
"layer",
")",
";",
"}",
"for",
"(",
"final",
"AddOn",
"addOn",
":",
"installedIdentity",
".",
"getAddOns",
"(",
")",
")",
"{",
"state",
".",
"putAddOn",
"(",
"addOn",
")",
";",
"}",
"return",
"state",
";",
"}"
] |
Load the installation state based on the identity
@param installedIdentity the installed identity
@return the installation state
@throws IOException
|
[
"Load",
"the",
"installation",
"state",
"based",
"on",
"the",
"identity"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentity.java#L173-L182
|
158,966
|
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentity.java
|
InstalledIdentity.load
|
public static InstalledIdentity load(final File jbossHome, final ProductConfig productConfig, final File... repoRoots) throws IOException {
final InstalledImage installedImage = installedImage(jbossHome);
return load(installedImage, productConfig, Arrays.<File>asList(repoRoots), Collections.<File>emptyList());
}
|
java
|
public static InstalledIdentity load(final File jbossHome, final ProductConfig productConfig, final File... repoRoots) throws IOException {
final InstalledImage installedImage = installedImage(jbossHome);
return load(installedImage, productConfig, Arrays.<File>asList(repoRoots), Collections.<File>emptyList());
}
|
[
"public",
"static",
"InstalledIdentity",
"load",
"(",
"final",
"File",
"jbossHome",
",",
"final",
"ProductConfig",
"productConfig",
",",
"final",
"File",
"...",
"repoRoots",
")",
"throws",
"IOException",
"{",
"final",
"InstalledImage",
"installedImage",
"=",
"installedImage",
"(",
"jbossHome",
")",
";",
"return",
"load",
"(",
"installedImage",
",",
"productConfig",
",",
"Arrays",
".",
"<",
"File",
">",
"asList",
"(",
"repoRoots",
")",
",",
"Collections",
".",
"<",
"File",
">",
"emptyList",
"(",
")",
")",
";",
"}"
] |
Load the layers based on the default setup.
@param jbossHome the jboss home directory
@param productConfig the product config
@param repoRoots the repository roots
@return the available layers
@throws IOException
|
[
"Load",
"the",
"layers",
"based",
"on",
"the",
"default",
"setup",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentity.java#L193-L196
|
158,967
|
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentity.java
|
InstalledIdentity.load
|
public static InstalledIdentity load(final InstalledImage installedImage, final ProductConfig productConfig, List<File> moduleRoots, final List<File> bundleRoots) throws IOException {
return LayersFactory.load(installedImage, productConfig, moduleRoots, bundleRoots);
}
|
java
|
public static InstalledIdentity load(final InstalledImage installedImage, final ProductConfig productConfig, List<File> moduleRoots, final List<File> bundleRoots) throws IOException {
return LayersFactory.load(installedImage, productConfig, moduleRoots, bundleRoots);
}
|
[
"public",
"static",
"InstalledIdentity",
"load",
"(",
"final",
"InstalledImage",
"installedImage",
",",
"final",
"ProductConfig",
"productConfig",
",",
"List",
"<",
"File",
">",
"moduleRoots",
",",
"final",
"List",
"<",
"File",
">",
"bundleRoots",
")",
"throws",
"IOException",
"{",
"return",
"LayersFactory",
".",
"load",
"(",
"installedImage",
",",
"productConfig",
",",
"moduleRoots",
",",
"bundleRoots",
")",
";",
"}"
] |
Load the InstalledIdentity configuration based on the module.path
@param installedImage the installed image
@param productConfig the product config
@param moduleRoots the module roots
@param bundleRoots the bundle roots
@return the available layers
@throws IOException
|
[
"Load",
"the",
"InstalledIdentity",
"configuration",
"based",
"on",
"the",
"module",
".",
"path"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/installation/InstalledIdentity.java#L208-L210
|
158,968
|
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionManager.java
|
ProtocolConnectionManager.shutdown
|
public void shutdown() {
final Connection connection;
synchronized (this) {
if(shutdown) return;
shutdown = true;
connection = this.connection;
if(connectTask != null) {
connectTask.shutdown();
}
}
if (connection != null) {
connection.closeAsync();
}
}
|
java
|
public void shutdown() {
final Connection connection;
synchronized (this) {
if(shutdown) return;
shutdown = true;
connection = this.connection;
if(connectTask != null) {
connectTask.shutdown();
}
}
if (connection != null) {
connection.closeAsync();
}
}
|
[
"public",
"void",
"shutdown",
"(",
")",
"{",
"final",
"Connection",
"connection",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"shutdown",
")",
"return",
";",
"shutdown",
"=",
"true",
";",
"connection",
"=",
"this",
".",
"connection",
";",
"if",
"(",
"connectTask",
"!=",
"null",
")",
"{",
"connectTask",
".",
"shutdown",
"(",
")",
";",
"}",
"}",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"connection",
".",
"closeAsync",
"(",
")",
";",
"}",
"}"
] |
Shutdown the connection manager.
|
[
"Shutdown",
"the",
"connection",
"manager",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionManager.java#L109-L122
|
158,969
|
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionManager.java
|
ProtocolConnectionManager.onConnectionClose
|
private void onConnectionClose(final Connection closed) {
synchronized (this) {
if(connection == closed) {
connection = null;
if(shutdown) {
connectTask = DISCONNECTED;
return;
}
final ConnectTask previous = connectTask;
connectTask = previous.connectionClosed();
}
}
}
|
java
|
private void onConnectionClose(final Connection closed) {
synchronized (this) {
if(connection == closed) {
connection = null;
if(shutdown) {
connectTask = DISCONNECTED;
return;
}
final ConnectTask previous = connectTask;
connectTask = previous.connectionClosed();
}
}
}
|
[
"private",
"void",
"onConnectionClose",
"(",
"final",
"Connection",
"closed",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"connection",
"==",
"closed",
")",
"{",
"connection",
"=",
"null",
";",
"if",
"(",
"shutdown",
")",
"{",
"connectTask",
"=",
"DISCONNECTED",
";",
"return",
";",
"}",
"final",
"ConnectTask",
"previous",
"=",
"connectTask",
";",
"connectTask",
"=",
"previous",
".",
"connectionClosed",
"(",
")",
";",
"}",
"}",
"}"
] |
Notification that a connection was closed.
@param closed the closed connection
|
[
"Notification",
"that",
"a",
"connection",
"was",
"closed",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionManager.java#L129-L141
|
158,970
|
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionManager.java
|
ProtocolConnectionManager.create
|
public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) {
return create(new EstablishedConnection(connection, openHandler));
}
|
java
|
public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) {
return create(new EstablishedConnection(connection, openHandler));
}
|
[
"public",
"static",
"ProtocolConnectionManager",
"create",
"(",
"final",
"Connection",
"connection",
",",
"final",
"ConnectionOpenHandler",
"openHandler",
")",
"{",
"return",
"create",
"(",
"new",
"EstablishedConnection",
"(",
"connection",
",",
"openHandler",
")",
")",
";",
"}"
] |
Create a new connection manager, based on an existing connection.
@param connection the existing connection
@param openHandler a connection open handler
@return the connected manager
|
[
"Create",
"a",
"new",
"connection",
"manager",
"based",
"on",
"an",
"existing",
"connection",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/ProtocolConnectionManager.java#L197-L199
|
158,971
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/remote/Pipe.java
|
Pipe.await
|
public void await() {
boolean intr = false;
final Object lock = this.lock;
try {
synchronized (lock) {
while (! readClosed) {
try {
lock.wait();
} catch (InterruptedException e) {
intr = true;
}
}
}
} finally {
if (intr) {
Thread.currentThread().interrupt();
}
}
}
|
java
|
public void await() {
boolean intr = false;
final Object lock = this.lock;
try {
synchronized (lock) {
while (! readClosed) {
try {
lock.wait();
} catch (InterruptedException e) {
intr = true;
}
}
}
} finally {
if (intr) {
Thread.currentThread().interrupt();
}
}
}
|
[
"public",
"void",
"await",
"(",
")",
"{",
"boolean",
"intr",
"=",
"false",
";",
"final",
"Object",
"lock",
"=",
"this",
".",
"lock",
";",
"try",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"while",
"(",
"!",
"readClosed",
")",
"{",
"try",
"{",
"lock",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"intr",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"intr",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"}",
"}"
] |
Wait for the read side to close. Used when the writer needs to know when
the reader finishes consuming a message.
|
[
"Wait",
"for",
"the",
"read",
"side",
"to",
"close",
".",
"Used",
"when",
"the",
"writer",
"needs",
"to",
"know",
"when",
"the",
"reader",
"finishes",
"consuming",
"a",
"message",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/Pipe.java#L66-L84
|
158,972
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java
|
ExtensionRegistry.removeExtension
|
public void removeExtension(Resource rootResource, String moduleName, ManagementResourceRegistration rootRegistration) throws IllegalStateException {
final ManagementResourceRegistration profileReg;
if (rootRegistration.getPathAddress().size() == 0) {
//domain or server extension
// Can't use processType.isServer() to determine where to look for profile reg because a lot of test infrastructure
// doesn't add the profile mrr even in HC-based tests
ManagementResourceRegistration reg = rootRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(PROFILE)));
if (reg == null) {
reg = rootRegistration;
}
profileReg = reg;
} else {
//host model extension
profileReg = rootRegistration;
}
ManagementResourceRegistration deploymentsReg = processType.isServer() ? rootRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT))) : null;
ExtensionInfo extension = extensions.remove(moduleName);
if (extension != null) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (extension) {
Set<String> subsystemNames = extension.subsystems.keySet();
final boolean dcExtension = processType.isHostController() ?
rootRegistration.getPathAddress().size() == 0 : false;
for (String subsystem : subsystemNames) {
if (hasSubsystemsRegistered(rootResource, subsystem, dcExtension)) {
// Restore the data
extensions.put(moduleName, extension);
throw ControllerLogger.ROOT_LOGGER.removingExtensionWithRegisteredSubsystem(moduleName, subsystem);
}
}
for (Map.Entry<String, SubsystemInformation> entry : extension.subsystems.entrySet()) {
String subsystem = entry.getKey();
profileReg.unregisterSubModel(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, subsystem));
if (deploymentsReg != null) {
deploymentsReg.unregisterSubModel(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, subsystem));
deploymentsReg.unregisterSubModel(PathElement.pathElement(ModelDescriptionConstants.SUBDEPLOYMENT, subsystem));
}
if (extension.xmlMapper != null) {
SubsystemInformationImpl subsystemInformation = SubsystemInformationImpl.class.cast(entry.getValue());
for (String namespace : subsystemInformation.getXMLNamespaces()) {
extension.xmlMapper.unregisterRootElement(new QName(namespace, SUBSYSTEM));
}
}
}
}
}
}
|
java
|
public void removeExtension(Resource rootResource, String moduleName, ManagementResourceRegistration rootRegistration) throws IllegalStateException {
final ManagementResourceRegistration profileReg;
if (rootRegistration.getPathAddress().size() == 0) {
//domain or server extension
// Can't use processType.isServer() to determine where to look for profile reg because a lot of test infrastructure
// doesn't add the profile mrr even in HC-based tests
ManagementResourceRegistration reg = rootRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(PROFILE)));
if (reg == null) {
reg = rootRegistration;
}
profileReg = reg;
} else {
//host model extension
profileReg = rootRegistration;
}
ManagementResourceRegistration deploymentsReg = processType.isServer() ? rootRegistration.getSubModel(PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT))) : null;
ExtensionInfo extension = extensions.remove(moduleName);
if (extension != null) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (extension) {
Set<String> subsystemNames = extension.subsystems.keySet();
final boolean dcExtension = processType.isHostController() ?
rootRegistration.getPathAddress().size() == 0 : false;
for (String subsystem : subsystemNames) {
if (hasSubsystemsRegistered(rootResource, subsystem, dcExtension)) {
// Restore the data
extensions.put(moduleName, extension);
throw ControllerLogger.ROOT_LOGGER.removingExtensionWithRegisteredSubsystem(moduleName, subsystem);
}
}
for (Map.Entry<String, SubsystemInformation> entry : extension.subsystems.entrySet()) {
String subsystem = entry.getKey();
profileReg.unregisterSubModel(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, subsystem));
if (deploymentsReg != null) {
deploymentsReg.unregisterSubModel(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, subsystem));
deploymentsReg.unregisterSubModel(PathElement.pathElement(ModelDescriptionConstants.SUBDEPLOYMENT, subsystem));
}
if (extension.xmlMapper != null) {
SubsystemInformationImpl subsystemInformation = SubsystemInformationImpl.class.cast(entry.getValue());
for (String namespace : subsystemInformation.getXMLNamespaces()) {
extension.xmlMapper.unregisterRootElement(new QName(namespace, SUBSYSTEM));
}
}
}
}
}
}
|
[
"public",
"void",
"removeExtension",
"(",
"Resource",
"rootResource",
",",
"String",
"moduleName",
",",
"ManagementResourceRegistration",
"rootRegistration",
")",
"throws",
"IllegalStateException",
"{",
"final",
"ManagementResourceRegistration",
"profileReg",
";",
"if",
"(",
"rootRegistration",
".",
"getPathAddress",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"//domain or server extension",
"// Can't use processType.isServer() to determine where to look for profile reg because a lot of test infrastructure",
"// doesn't add the profile mrr even in HC-based tests",
"ManagementResourceRegistration",
"reg",
"=",
"rootRegistration",
".",
"getSubModel",
"(",
"PathAddress",
".",
"pathAddress",
"(",
"PathElement",
".",
"pathElement",
"(",
"PROFILE",
")",
")",
")",
";",
"if",
"(",
"reg",
"==",
"null",
")",
"{",
"reg",
"=",
"rootRegistration",
";",
"}",
"profileReg",
"=",
"reg",
";",
"}",
"else",
"{",
"//host model extension",
"profileReg",
"=",
"rootRegistration",
";",
"}",
"ManagementResourceRegistration",
"deploymentsReg",
"=",
"processType",
".",
"isServer",
"(",
")",
"?",
"rootRegistration",
".",
"getSubModel",
"(",
"PathAddress",
".",
"pathAddress",
"(",
"PathElement",
".",
"pathElement",
"(",
"DEPLOYMENT",
")",
")",
")",
":",
"null",
";",
"ExtensionInfo",
"extension",
"=",
"extensions",
".",
"remove",
"(",
"moduleName",
")",
";",
"if",
"(",
"extension",
"!=",
"null",
")",
"{",
"//noinspection SynchronizationOnLocalVariableOrMethodParameter",
"synchronized",
"(",
"extension",
")",
"{",
"Set",
"<",
"String",
">",
"subsystemNames",
"=",
"extension",
".",
"subsystems",
".",
"keySet",
"(",
")",
";",
"final",
"boolean",
"dcExtension",
"=",
"processType",
".",
"isHostController",
"(",
")",
"?",
"rootRegistration",
".",
"getPathAddress",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
":",
"false",
";",
"for",
"(",
"String",
"subsystem",
":",
"subsystemNames",
")",
"{",
"if",
"(",
"hasSubsystemsRegistered",
"(",
"rootResource",
",",
"subsystem",
",",
"dcExtension",
")",
")",
"{",
"// Restore the data",
"extensions",
".",
"put",
"(",
"moduleName",
",",
"extension",
")",
";",
"throw",
"ControllerLogger",
".",
"ROOT_LOGGER",
".",
"removingExtensionWithRegisteredSubsystem",
"(",
"moduleName",
",",
"subsystem",
")",
";",
"}",
"}",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"SubsystemInformation",
">",
"entry",
":",
"extension",
".",
"subsystems",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"subsystem",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"profileReg",
".",
"unregisterSubModel",
"(",
"PathElement",
".",
"pathElement",
"(",
"ModelDescriptionConstants",
".",
"SUBSYSTEM",
",",
"subsystem",
")",
")",
";",
"if",
"(",
"deploymentsReg",
"!=",
"null",
")",
"{",
"deploymentsReg",
".",
"unregisterSubModel",
"(",
"PathElement",
".",
"pathElement",
"(",
"ModelDescriptionConstants",
".",
"SUBSYSTEM",
",",
"subsystem",
")",
")",
";",
"deploymentsReg",
".",
"unregisterSubModel",
"(",
"PathElement",
".",
"pathElement",
"(",
"ModelDescriptionConstants",
".",
"SUBDEPLOYMENT",
",",
"subsystem",
")",
")",
";",
"}",
"if",
"(",
"extension",
".",
"xmlMapper",
"!=",
"null",
")",
"{",
"SubsystemInformationImpl",
"subsystemInformation",
"=",
"SubsystemInformationImpl",
".",
"class",
".",
"cast",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"for",
"(",
"String",
"namespace",
":",
"subsystemInformation",
".",
"getXMLNamespaces",
"(",
")",
")",
"{",
"extension",
".",
"xmlMapper",
".",
"unregisterRootElement",
"(",
"new",
"QName",
"(",
"namespace",
",",
"SUBSYSTEM",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}"
] |
Cleans up a extension module's subsystems from the resource registration model.
@param rootResource the model root resource
@param moduleName the name of the extension's module. Cannot be {@code null}
@throws IllegalStateException if the extension still has subsystems present in {@code rootResource} or its children
|
[
"Cleans",
"up",
"a",
"extension",
"module",
"s",
"subsystems",
"from",
"the",
"resource",
"registration",
"model",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java#L316-L366
|
158,973
|
wildfly/wildfly-core
|
host-controller/src/main/java/org/jboss/as/domain/controller/plan/AbstractServerGroupRolloutTask.java
|
AbstractServerGroupRolloutTask.recordPreparedOperation
|
protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) {
final ModelNode preparedResult = prepared.getPreparedResult();
// Hmm do the server results need to get translated as well as the host one?
// final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult);
updatePolicy.recordServerResult(identity, preparedResult);
executor.recordPreparedOperation(prepared);
}
|
java
|
protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) {
final ModelNode preparedResult = prepared.getPreparedResult();
// Hmm do the server results need to get translated as well as the host one?
// final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult);
updatePolicy.recordServerResult(identity, preparedResult);
executor.recordPreparedOperation(prepared);
}
|
[
"protected",
"void",
"recordPreparedOperation",
"(",
"final",
"ServerIdentity",
"identity",
",",
"final",
"TransactionalProtocolClient",
".",
"PreparedOperation",
"<",
"ServerTaskExecutor",
".",
"ServerOperation",
">",
"prepared",
")",
"{",
"final",
"ModelNode",
"preparedResult",
"=",
"prepared",
".",
"getPreparedResult",
"(",
")",
";",
"// Hmm do the server results need to get translated as well as the host one?",
"// final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult);",
"updatePolicy",
".",
"recordServerResult",
"(",
"identity",
",",
"preparedResult",
")",
";",
"executor",
".",
"recordPreparedOperation",
"(",
"prepared",
")",
";",
"}"
] |
Record a prepared operation.
@param identity the server identity
@param prepared the prepared operation
|
[
"Record",
"a",
"prepared",
"operation",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/AbstractServerGroupRolloutTask.java#L97-L103
|
158,974
|
wildfly/wildfly-core
|
launcher/src/main/java/org/wildfly/core/launcher/Jvm.java
|
Jvm.resolveJavaCommand
|
private static String resolveJavaCommand(final Path javaHome) {
final String exe;
if (javaHome == null) {
exe = "java";
} else {
exe = javaHome.resolve("bin").resolve("java").toString();
}
if (exe.contains(" ")) {
return "\"" + exe + "\"";
}
return exe;
}
|
java
|
private static String resolveJavaCommand(final Path javaHome) {
final String exe;
if (javaHome == null) {
exe = "java";
} else {
exe = javaHome.resolve("bin").resolve("java").toString();
}
if (exe.contains(" ")) {
return "\"" + exe + "\"";
}
return exe;
}
|
[
"private",
"static",
"String",
"resolveJavaCommand",
"(",
"final",
"Path",
"javaHome",
")",
"{",
"final",
"String",
"exe",
";",
"if",
"(",
"javaHome",
"==",
"null",
")",
"{",
"exe",
"=",
"\"java\"",
";",
"}",
"else",
"{",
"exe",
"=",
"javaHome",
".",
"resolve",
"(",
"\"bin\"",
")",
".",
"resolve",
"(",
"\"java\"",
")",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"exe",
".",
"contains",
"(",
"\" \"",
")",
")",
"{",
"return",
"\"\\\"\"",
"+",
"exe",
"+",
"\"\\\"\"",
";",
"}",
"return",
"exe",
";",
"}"
] |
Returns the Java executable command.
@param javaHome the java home directory or {@code null} to use the default
@return the java command to use
|
[
"Returns",
"the",
"Java",
"executable",
"command",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/launcher/src/main/java/org/wildfly/core/launcher/Jvm.java#L244-L255
|
158,975
|
wildfly/wildfly-core
|
patching/src/main/java/org/jboss/as/patching/metadata/MiscContentItem.java
|
MiscContentItem.getRelativePath
|
public String getRelativePath() {
final StringBuilder builder = new StringBuilder();
for(final String p : path) {
builder.append(p).append("/");
}
builder.append(getName());
return builder.toString();
}
|
java
|
public String getRelativePath() {
final StringBuilder builder = new StringBuilder();
for(final String p : path) {
builder.append(p).append("/");
}
builder.append(getName());
return builder.toString();
}
|
[
"public",
"String",
"getRelativePath",
"(",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"p",
":",
"path",
")",
"{",
"builder",
".",
"append",
"(",
"p",
")",
".",
"append",
"(",
"\"/\"",
")",
";",
"}",
"builder",
".",
"append",
"(",
"getName",
"(",
")",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] |
Get the relative path.
@return the relative path
|
[
"Get",
"the",
"relative",
"path",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/metadata/MiscContentItem.java#L84-L91
|
158,976
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/gui/metacommand/ScriptAction.java
|
ScriptAction.runScript
|
protected void runScript(File script) {
if (!script.exists()) {
JOptionPane.showMessageDialog(cliGuiCtx.getMainPanel(), script.getAbsolutePath() + " does not exist.",
"Unable to run script.", JOptionPane.ERROR_MESSAGE);
return;
}
int choice = JOptionPane.showConfirmDialog(cliGuiCtx.getMainPanel(), "Run CLI script " + script.getName() + "?",
"Confirm run script", JOptionPane.YES_NO_OPTION);
if (choice != JOptionPane.YES_OPTION) return;
menu.addScript(script);
cliGuiCtx.getTabs().setSelectedIndex(1); // set to Output tab to view the output
output.post("\n");
SwingWorker scriptRunner = new ScriptRunner(script);
scriptRunner.execute();
}
|
java
|
protected void runScript(File script) {
if (!script.exists()) {
JOptionPane.showMessageDialog(cliGuiCtx.getMainPanel(), script.getAbsolutePath() + " does not exist.",
"Unable to run script.", JOptionPane.ERROR_MESSAGE);
return;
}
int choice = JOptionPane.showConfirmDialog(cliGuiCtx.getMainPanel(), "Run CLI script " + script.getName() + "?",
"Confirm run script", JOptionPane.YES_NO_OPTION);
if (choice != JOptionPane.YES_OPTION) return;
menu.addScript(script);
cliGuiCtx.getTabs().setSelectedIndex(1); // set to Output tab to view the output
output.post("\n");
SwingWorker scriptRunner = new ScriptRunner(script);
scriptRunner.execute();
}
|
[
"protected",
"void",
"runScript",
"(",
"File",
"script",
")",
"{",
"if",
"(",
"!",
"script",
".",
"exists",
"(",
")",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"cliGuiCtx",
".",
"getMainPanel",
"(",
")",
",",
"script",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" does not exist.\"",
",",
"\"Unable to run script.\"",
",",
"JOptionPane",
".",
"ERROR_MESSAGE",
")",
";",
"return",
";",
"}",
"int",
"choice",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"cliGuiCtx",
".",
"getMainPanel",
"(",
")",
",",
"\"Run CLI script \"",
"+",
"script",
".",
"getName",
"(",
")",
"+",
"\"?\"",
",",
"\"Confirm run script\"",
",",
"JOptionPane",
".",
"YES_NO_OPTION",
")",
";",
"if",
"(",
"choice",
"!=",
"JOptionPane",
".",
"YES_OPTION",
")",
"return",
";",
"menu",
".",
"addScript",
"(",
"script",
")",
";",
"cliGuiCtx",
".",
"getTabs",
"(",
")",
".",
"setSelectedIndex",
"(",
"1",
")",
";",
"// set to Output tab to view the output",
"output",
".",
"post",
"(",
"\"\\n\"",
")",
";",
"SwingWorker",
"scriptRunner",
"=",
"new",
"ScriptRunner",
"(",
"script",
")",
";",
"scriptRunner",
".",
"execute",
"(",
")",
";",
"}"
] |
Run a CLI script from a File.
@param script The script file.
|
[
"Run",
"a",
"CLI",
"script",
"from",
"a",
"File",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/metacommand/ScriptAction.java#L65-L83
|
158,977
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/gui/metacommand/ScriptAction.java
|
ScriptAction.getCommandLines
|
private List<String> getCommandLines(File file) {
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line = reader.readLine();
while (line != null) {
lines.add(line);
line = reader.readLine();
}
} catch (Throwable e) {
throw new IllegalStateException("Failed to process file " + file.getAbsolutePath(), e);
}
return lines;
}
|
java
|
private List<String> getCommandLines(File file) {
List<String> lines = new ArrayList<>();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line = reader.readLine();
while (line != null) {
lines.add(line);
line = reader.readLine();
}
} catch (Throwable e) {
throw new IllegalStateException("Failed to process file " + file.getAbsolutePath(), e);
}
return lines;
}
|
[
"private",
"List",
"<",
"String",
">",
"getCommandLines",
"(",
"File",
"file",
")",
"{",
"List",
"<",
"String",
">",
"lines",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"(",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"file",
")",
")",
")",
"{",
"String",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"while",
"(",
"line",
"!=",
"null",
")",
"{",
"lines",
".",
"add",
"(",
"line",
")",
";",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Failed to process file \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"lines",
";",
"}"
] |
read the file as a list of text lines
|
[
"read",
"the",
"file",
"as",
"a",
"list",
"of",
"text",
"lines"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/gui/metacommand/ScriptAction.java#L86-L98
|
158,978
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/access/TargetAttribute.java
|
TargetAttribute.getFlags
|
public Set<AttributeAccess.Flag> getFlags() {
if (attributeAccess == null) {
return Collections.emptySet();
}
return attributeAccess.getFlags();
}
|
java
|
public Set<AttributeAccess.Flag> getFlags() {
if (attributeAccess == null) {
return Collections.emptySet();
}
return attributeAccess.getFlags();
}
|
[
"public",
"Set",
"<",
"AttributeAccess",
".",
"Flag",
">",
"getFlags",
"(",
")",
"{",
"if",
"(",
"attributeAccess",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"return",
"attributeAccess",
".",
"getFlags",
"(",
")",
";",
"}"
] |
Gets the flags associated with this attribute.
@return the flags. Will not return {@code null}
|
[
"Gets",
"the",
"flags",
"associated",
"with",
"this",
"attribute",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/access/TargetAttribute.java#L90-L95
|
158,979
|
wildfly/wildfly-core
|
domain-management/src/main/java/org/jboss/as/domain/management/security/AuthenticationValidatingHandler.java
|
AuthenticationValidatingHandler.createOperation
|
static ModelNode createOperation(final ModelNode operationToValidate) {
PathAddress pa = PathAddress.pathAddress(operationToValidate.require(ModelDescriptionConstants.OP_ADDR));
PathAddress realmPA = null;
for (int i = pa.size() - 1; i > 0; i--) {
PathElement pe = pa.getElement(i);
if (SECURITY_REALM.equals(pe.getKey())) {
realmPA = pa.subAddress(0, i + 1);
break;
}
}
assert realmPA != null : "operationToValidate did not have an address that included a " + SECURITY_REALM;
return Util.getEmptyOperation("validate-authentication", realmPA.toModelNode());
}
|
java
|
static ModelNode createOperation(final ModelNode operationToValidate) {
PathAddress pa = PathAddress.pathAddress(operationToValidate.require(ModelDescriptionConstants.OP_ADDR));
PathAddress realmPA = null;
for (int i = pa.size() - 1; i > 0; i--) {
PathElement pe = pa.getElement(i);
if (SECURITY_REALM.equals(pe.getKey())) {
realmPA = pa.subAddress(0, i + 1);
break;
}
}
assert realmPA != null : "operationToValidate did not have an address that included a " + SECURITY_REALM;
return Util.getEmptyOperation("validate-authentication", realmPA.toModelNode());
}
|
[
"static",
"ModelNode",
"createOperation",
"(",
"final",
"ModelNode",
"operationToValidate",
")",
"{",
"PathAddress",
"pa",
"=",
"PathAddress",
".",
"pathAddress",
"(",
"operationToValidate",
".",
"require",
"(",
"ModelDescriptionConstants",
".",
"OP_ADDR",
")",
")",
";",
"PathAddress",
"realmPA",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"pa",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"{",
"PathElement",
"pe",
"=",
"pa",
".",
"getElement",
"(",
"i",
")",
";",
"if",
"(",
"SECURITY_REALM",
".",
"equals",
"(",
"pe",
".",
"getKey",
"(",
")",
")",
")",
"{",
"realmPA",
"=",
"pa",
".",
"subAddress",
"(",
"0",
",",
"i",
"+",
"1",
")",
";",
"break",
";",
"}",
"}",
"assert",
"realmPA",
"!=",
"null",
":",
"\"operationToValidate did not have an address that included a \"",
"+",
"SECURITY_REALM",
";",
"return",
"Util",
".",
"getEmptyOperation",
"(",
"\"validate-authentication\"",
",",
"realmPA",
".",
"toModelNode",
"(",
")",
")",
";",
"}"
] |
Creates an operations that targets this handler.
@param operationToValidate the operation that this handler will validate
@return the validation operation
|
[
"Creates",
"an",
"operations",
"that",
"targets",
"this",
"handler",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/AuthenticationValidatingHandler.java#L60-L72
|
158,980
|
wildfly/wildfly-core
|
remoting/subsystem/src/main/java/org/jboss/as/remoting/RemotingServices.java
|
RemotingServices.channelServiceName
|
public static ServiceName channelServiceName(final ServiceName endpointName, final String channelName) {
return endpointName.append("channel").append(channelName);
}
|
java
|
public static ServiceName channelServiceName(final ServiceName endpointName, final String channelName) {
return endpointName.append("channel").append(channelName);
}
|
[
"public",
"static",
"ServiceName",
"channelServiceName",
"(",
"final",
"ServiceName",
"endpointName",
",",
"final",
"String",
"channelName",
")",
"{",
"return",
"endpointName",
".",
"append",
"(",
"\"channel\"",
")",
".",
"append",
"(",
"channelName",
")",
";",
"}"
] |
Create the service name for a channel
@param channelName
the channel name
@return the service name
|
[
"Create",
"the",
"service",
"name",
"for",
"a",
"channel"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/RemotingServices.java#L96-L98
|
158,981
|
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelHandler.java
|
ManagementChannelHandler.getRemoteAddress
|
public InetAddress getRemoteAddress() {
final Channel channel;
try {
channel = strategy.getChannel();
} catch (IOException e) {
return null;
}
final Connection connection = channel.getConnection();
final InetSocketAddress peerAddress = connection.getPeerAddress(InetSocketAddress.class);
return peerAddress == null ? null : peerAddress.getAddress();
}
|
java
|
public InetAddress getRemoteAddress() {
final Channel channel;
try {
channel = strategy.getChannel();
} catch (IOException e) {
return null;
}
final Connection connection = channel.getConnection();
final InetSocketAddress peerAddress = connection.getPeerAddress(InetSocketAddress.class);
return peerAddress == null ? null : peerAddress.getAddress();
}
|
[
"public",
"InetAddress",
"getRemoteAddress",
"(",
")",
"{",
"final",
"Channel",
"channel",
";",
"try",
"{",
"channel",
"=",
"strategy",
".",
"getChannel",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Connection",
"connection",
"=",
"channel",
".",
"getConnection",
"(",
")",
";",
"final",
"InetSocketAddress",
"peerAddress",
"=",
"connection",
".",
"getPeerAddress",
"(",
"InetSocketAddress",
".",
"class",
")",
";",
"return",
"peerAddress",
"==",
"null",
"?",
"null",
":",
"peerAddress",
".",
"getAddress",
"(",
")",
";",
"}"
] |
Get the remote address.
@return the remote address, {@code null} if not available
|
[
"Get",
"the",
"remote",
"address",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelHandler.java#L89-L99
|
158,982
|
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelHandler.java
|
ManagementChannelHandler.addHandlerFactory
|
public void addHandlerFactory(ManagementRequestHandlerFactory factory) {
for (;;) {
final ManagementRequestHandlerFactory[] snapshot = updater.get(this);
final int length = snapshot.length;
final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[length + 1];
System.arraycopy(snapshot, 0, newVal, 0, length);
newVal[length] = factory;
if (updater.compareAndSet(this, snapshot, newVal)) {
return;
}
}
}
|
java
|
public void addHandlerFactory(ManagementRequestHandlerFactory factory) {
for (;;) {
final ManagementRequestHandlerFactory[] snapshot = updater.get(this);
final int length = snapshot.length;
final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[length + 1];
System.arraycopy(snapshot, 0, newVal, 0, length);
newVal[length] = factory;
if (updater.compareAndSet(this, snapshot, newVal)) {
return;
}
}
}
|
[
"public",
"void",
"addHandlerFactory",
"(",
"ManagementRequestHandlerFactory",
"factory",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"final",
"ManagementRequestHandlerFactory",
"[",
"]",
"snapshot",
"=",
"updater",
".",
"get",
"(",
"this",
")",
";",
"final",
"int",
"length",
"=",
"snapshot",
".",
"length",
";",
"final",
"ManagementRequestHandlerFactory",
"[",
"]",
"newVal",
"=",
"new",
"ManagementRequestHandlerFactory",
"[",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"snapshot",
",",
"0",
",",
"newVal",
",",
"0",
",",
"length",
")",
";",
"newVal",
"[",
"length",
"]",
"=",
"factory",
";",
"if",
"(",
"updater",
".",
"compareAndSet",
"(",
"this",
",",
"snapshot",
",",
"newVal",
")",
")",
"{",
"return",
";",
"}",
"}",
"}"
] |
Add a management request handler factory to this context.
@param factory the request handler to add
|
[
"Add",
"a",
"management",
"request",
"handler",
"factory",
"to",
"this",
"context",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelHandler.java#L202-L213
|
158,983
|
wildfly/wildfly-core
|
protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelHandler.java
|
ManagementChannelHandler.removeHandlerFactory
|
public boolean removeHandlerFactory(ManagementRequestHandlerFactory instance) {
for(;;) {
final ManagementRequestHandlerFactory[] snapshot = updater.get(this);
final int length = snapshot.length;
int index = -1;
for(int i = 0; i < length; i++) {
if(snapshot[i] == instance) {
index = i;
break;
}
}
if(index == -1) {
return false;
}
final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[length - 1];
System.arraycopy(snapshot, 0, newVal, 0, index);
System.arraycopy(snapshot, index + 1, newVal, index, length - index - 1);
if (updater.compareAndSet(this, snapshot, newVal)) {
return true;
}
}
}
|
java
|
public boolean removeHandlerFactory(ManagementRequestHandlerFactory instance) {
for(;;) {
final ManagementRequestHandlerFactory[] snapshot = updater.get(this);
final int length = snapshot.length;
int index = -1;
for(int i = 0; i < length; i++) {
if(snapshot[i] == instance) {
index = i;
break;
}
}
if(index == -1) {
return false;
}
final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[length - 1];
System.arraycopy(snapshot, 0, newVal, 0, index);
System.arraycopy(snapshot, index + 1, newVal, index, length - index - 1);
if (updater.compareAndSet(this, snapshot, newVal)) {
return true;
}
}
}
|
[
"public",
"boolean",
"removeHandlerFactory",
"(",
"ManagementRequestHandlerFactory",
"instance",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"final",
"ManagementRequestHandlerFactory",
"[",
"]",
"snapshot",
"=",
"updater",
".",
"get",
"(",
"this",
")",
";",
"final",
"int",
"length",
"=",
"snapshot",
".",
"length",
";",
"int",
"index",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"snapshot",
"[",
"i",
"]",
"==",
"instance",
")",
"{",
"index",
"=",
"i",
";",
"break",
";",
"}",
"}",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"return",
"false",
";",
"}",
"final",
"ManagementRequestHandlerFactory",
"[",
"]",
"newVal",
"=",
"new",
"ManagementRequestHandlerFactory",
"[",
"length",
"-",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"snapshot",
",",
"0",
",",
"newVal",
",",
"0",
",",
"index",
")",
";",
"System",
".",
"arraycopy",
"(",
"snapshot",
",",
"index",
"+",
"1",
",",
"newVal",
",",
"index",
",",
"length",
"-",
"index",
"-",
"1",
")",
";",
"if",
"(",
"updater",
".",
"compareAndSet",
"(",
"this",
",",
"snapshot",
",",
"newVal",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}"
] |
Remove a management request handler factory from this context.
@param instance the request handler factory
@return {@code true} if the instance was removed, {@code false} otherwise
|
[
"Remove",
"a",
"management",
"request",
"handler",
"factory",
"from",
"this",
"context",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/ManagementChannelHandler.java#L221-L242
|
158,984
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/handlers/FilenameTabCompleter.java
|
FilenameTabCompleter.translatePath
|
public String translatePath(String path) {
String translated;
// special character: ~ maps to the user's home directory
if (path.startsWith("~" + File.separator)) {
translated = System.getProperty("user.home") + path.substring(1);
} else if (path.startsWith("~")) {
String userName = path.substring(1);
translated = new File(new File(System.getProperty("user.home")).getParent(),
userName).getAbsolutePath();
// Keep the path separator in translated or add one if no user home specified
translated = userName.isEmpty() || path.endsWith(File.separator) ? translated + File.separator : translated;
} else if (!new File(path).isAbsolute()) {
translated = ctx.getCurrentDir().getAbsolutePath() + File.separator + path;
} else {
translated = path;
}
return translated;
}
|
java
|
public String translatePath(String path) {
String translated;
// special character: ~ maps to the user's home directory
if (path.startsWith("~" + File.separator)) {
translated = System.getProperty("user.home") + path.substring(1);
} else if (path.startsWith("~")) {
String userName = path.substring(1);
translated = new File(new File(System.getProperty("user.home")).getParent(),
userName).getAbsolutePath();
// Keep the path separator in translated or add one if no user home specified
translated = userName.isEmpty() || path.endsWith(File.separator) ? translated + File.separator : translated;
} else if (!new File(path).isAbsolute()) {
translated = ctx.getCurrentDir().getAbsolutePath() + File.separator + path;
} else {
translated = path;
}
return translated;
}
|
[
"public",
"String",
"translatePath",
"(",
"String",
"path",
")",
"{",
"String",
"translated",
";",
"// special character: ~ maps to the user's home directory",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"~\"",
"+",
"File",
".",
"separator",
")",
")",
"{",
"translated",
"=",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
")",
"+",
"path",
".",
"substring",
"(",
"1",
")",
";",
"}",
"else",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"~\"",
")",
")",
"{",
"String",
"userName",
"=",
"path",
".",
"substring",
"(",
"1",
")",
";",
"translated",
"=",
"new",
"File",
"(",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
")",
")",
".",
"getParent",
"(",
")",
",",
"userName",
")",
".",
"getAbsolutePath",
"(",
")",
";",
"// Keep the path separator in translated or add one if no user home specified",
"translated",
"=",
"userName",
".",
"isEmpty",
"(",
")",
"||",
"path",
".",
"endsWith",
"(",
"File",
".",
"separator",
")",
"?",
"translated",
"+",
"File",
".",
"separator",
":",
"translated",
";",
"}",
"else",
"if",
"(",
"!",
"new",
"File",
"(",
"path",
")",
".",
"isAbsolute",
"(",
")",
")",
"{",
"translated",
"=",
"ctx",
".",
"getCurrentDir",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"path",
";",
"}",
"else",
"{",
"translated",
"=",
"path",
";",
"}",
"return",
"translated",
";",
"}"
] |
Translate a path that has previously been unescaped and unquoted.
That is called at command execution when the calue is retrieved prior to be
used as ModelNode value.
@param path The unquoted, unescaped path.
@return A path with ~ and default dir expanded.
|
[
"Translate",
"a",
"path",
"that",
"has",
"previously",
"been",
"unescaped",
"and",
"unquoted",
".",
"That",
"is",
"called",
"at",
"command",
"execution",
"when",
"the",
"calue",
"is",
"retrieved",
"prior",
"to",
"be",
"used",
"as",
"ModelNode",
"value",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/FilenameTabCompleter.java#L81-L98
|
158,985
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/handlers/FilenameTabCompleter.java
|
FilenameTabCompleter.clearPath
|
private static String clearPath(String path) {
try {
ExpressionBaseState state = new ExpressionBaseState("EXPR", true, false);
if (Util.isWindows()) {
// to not require escaping FS name separator
state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_OFF);
} else {
state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_ON);
}
// Remove escaping characters
path = ArgumentWithValue.resolveValue(path, state);
} catch (CommandFormatException ex) {
// XXX OK, continue translation
}
// Remove quote to retrieve candidates.
if (path.startsWith("\"")) {
path = path.substring(1);
}
// Could be an escaped " character. We don't take into account this corner case.
// concider it the end of the quoted part.
if (path.endsWith("\"")) {
path = path.substring(0, path.length() - 1);
}
return path;
}
|
java
|
private static String clearPath(String path) {
try {
ExpressionBaseState state = new ExpressionBaseState("EXPR", true, false);
if (Util.isWindows()) {
// to not require escaping FS name separator
state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_OFF);
} else {
state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAPE_ON);
}
// Remove escaping characters
path = ArgumentWithValue.resolveValue(path, state);
} catch (CommandFormatException ex) {
// XXX OK, continue translation
}
// Remove quote to retrieve candidates.
if (path.startsWith("\"")) {
path = path.substring(1);
}
// Could be an escaped " character. We don't take into account this corner case.
// concider it the end of the quoted part.
if (path.endsWith("\"")) {
path = path.substring(0, path.length() - 1);
}
return path;
}
|
[
"private",
"static",
"String",
"clearPath",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"ExpressionBaseState",
"state",
"=",
"new",
"ExpressionBaseState",
"(",
"\"EXPR\"",
",",
"true",
",",
"false",
")",
";",
"if",
"(",
"Util",
".",
"isWindows",
"(",
")",
")",
"{",
"// to not require escaping FS name separator",
"state",
".",
"setDefaultHandler",
"(",
"WordCharacterHandler",
".",
"IGNORE_LB_ESCAPE_OFF",
")",
";",
"}",
"else",
"{",
"state",
".",
"setDefaultHandler",
"(",
"WordCharacterHandler",
".",
"IGNORE_LB_ESCAPE_ON",
")",
";",
"}",
"// Remove escaping characters",
"path",
"=",
"ArgumentWithValue",
".",
"resolveValue",
"(",
"path",
",",
"state",
")",
";",
"}",
"catch",
"(",
"CommandFormatException",
"ex",
")",
"{",
"// XXX OK, continue translation",
"}",
"// Remove quote to retrieve candidates.",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"\\\"\"",
")",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"1",
")",
";",
"}",
"// Could be an escaped \" character. We don't take into account this corner case.",
"// concider it the end of the quoted part.",
"if",
"(",
"path",
".",
"endsWith",
"(",
"\"\\\"\"",
")",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"0",
",",
"path",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"return",
"path",
";",
"}"
] |
Unescape and unquote the path. Ready for translation.
|
[
"Unescape",
"and",
"unquote",
"the",
"path",
".",
"Ready",
"for",
"translation",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/FilenameTabCompleter.java#L103-L127
|
158,986
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java
|
RequestController.resume
|
@Override
public synchronized void resume() {
this.paused = false;
ServerActivityCallback listener = listenerUpdater.get(this);
if (listener != null) {
listenerUpdater.compareAndSet(this, listener, null);
}
while (!taskQueue.isEmpty() && (activeRequestCount < maxRequestCount || maxRequestCount < 0)) {
runQueuedTask(false);
}
}
|
java
|
@Override
public synchronized void resume() {
this.paused = false;
ServerActivityCallback listener = listenerUpdater.get(this);
if (listener != null) {
listenerUpdater.compareAndSet(this, listener, null);
}
while (!taskQueue.isEmpty() && (activeRequestCount < maxRequestCount || maxRequestCount < 0)) {
runQueuedTask(false);
}
}
|
[
"@",
"Override",
"public",
"synchronized",
"void",
"resume",
"(",
")",
"{",
"this",
".",
"paused",
"=",
"false",
";",
"ServerActivityCallback",
"listener",
"=",
"listenerUpdater",
".",
"get",
"(",
"this",
")",
";",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"listenerUpdater",
".",
"compareAndSet",
"(",
"this",
",",
"listener",
",",
"null",
")",
";",
"}",
"while",
"(",
"!",
"taskQueue",
".",
"isEmpty",
"(",
")",
"&&",
"(",
"activeRequestCount",
"<",
"maxRequestCount",
"||",
"maxRequestCount",
"<",
"0",
")",
")",
"{",
"runQueuedTask",
"(",
"false",
")",
";",
"}",
"}"
] |
Unpause the server, allowing it to resume normal operations
|
[
"Unpause",
"the",
"server",
"allowing",
"it",
"to",
"resume",
"normal",
"operations"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java#L118-L128
|
158,987
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java
|
RequestController.pauseDeployment
|
public synchronized void pauseDeployment(final String deployment, ServerActivityCallback listener) {
final List<ControlPoint> eps = new ArrayList<ControlPoint>();
for (ControlPoint ep : entryPoints.values()) {
if (ep.getDeployment().equals(deployment)) {
if(!ep.isPaused()) {
eps.add(ep);
}
}
}
CountingRequestCountCallback realListener = new CountingRequestCountCallback(eps.size(), listener);
for (ControlPoint ep : eps) {
ep.pause(realListener);
}
}
|
java
|
public synchronized void pauseDeployment(final String deployment, ServerActivityCallback listener) {
final List<ControlPoint> eps = new ArrayList<ControlPoint>();
for (ControlPoint ep : entryPoints.values()) {
if (ep.getDeployment().equals(deployment)) {
if(!ep.isPaused()) {
eps.add(ep);
}
}
}
CountingRequestCountCallback realListener = new CountingRequestCountCallback(eps.size(), listener);
for (ControlPoint ep : eps) {
ep.pause(realListener);
}
}
|
[
"public",
"synchronized",
"void",
"pauseDeployment",
"(",
"final",
"String",
"deployment",
",",
"ServerActivityCallback",
"listener",
")",
"{",
"final",
"List",
"<",
"ControlPoint",
">",
"eps",
"=",
"new",
"ArrayList",
"<",
"ControlPoint",
">",
"(",
")",
";",
"for",
"(",
"ControlPoint",
"ep",
":",
"entryPoints",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"ep",
".",
"getDeployment",
"(",
")",
".",
"equals",
"(",
"deployment",
")",
")",
"{",
"if",
"(",
"!",
"ep",
".",
"isPaused",
"(",
")",
")",
"{",
"eps",
".",
"add",
"(",
"ep",
")",
";",
"}",
"}",
"}",
"CountingRequestCountCallback",
"realListener",
"=",
"new",
"CountingRequestCountCallback",
"(",
"eps",
".",
"size",
"(",
")",
",",
"listener",
")",
";",
"for",
"(",
"ControlPoint",
"ep",
":",
"eps",
")",
"{",
"ep",
".",
"pause",
"(",
"realListener",
")",
";",
"}",
"}"
] |
Pauses a given deployment
@param deployment The deployment to pause
@param listener The listener that will be notified when the pause is complete
|
[
"Pauses",
"a",
"given",
"deployment"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java#L136-L149
|
158,988
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java
|
RequestController.resumeDeployment
|
public synchronized void resumeDeployment(final String deployment) {
for (ControlPoint ep : entryPoints.values()) {
if (ep.getDeployment().equals(deployment)) {
ep.resume();
}
}
}
|
java
|
public synchronized void resumeDeployment(final String deployment) {
for (ControlPoint ep : entryPoints.values()) {
if (ep.getDeployment().equals(deployment)) {
ep.resume();
}
}
}
|
[
"public",
"synchronized",
"void",
"resumeDeployment",
"(",
"final",
"String",
"deployment",
")",
"{",
"for",
"(",
"ControlPoint",
"ep",
":",
"entryPoints",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"ep",
".",
"getDeployment",
"(",
")",
".",
"equals",
"(",
"deployment",
")",
")",
"{",
"ep",
".",
"resume",
"(",
")",
";",
"}",
"}",
"}"
] |
resumed a given deployment
@param deployment The deployment to resume
|
[
"resumed",
"a",
"given",
"deployment"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java#L156-L162
|
158,989
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java
|
RequestController.resumeControlPoint
|
public synchronized void resumeControlPoint(final String entryPoint) {
for (ControlPoint ep : entryPoints.values()) {
if (ep.getEntryPoint().equals(entryPoint)) {
ep.resume();
}
}
}
|
java
|
public synchronized void resumeControlPoint(final String entryPoint) {
for (ControlPoint ep : entryPoints.values()) {
if (ep.getEntryPoint().equals(entryPoint)) {
ep.resume();
}
}
}
|
[
"public",
"synchronized",
"void",
"resumeControlPoint",
"(",
"final",
"String",
"entryPoint",
")",
"{",
"for",
"(",
"ControlPoint",
"ep",
":",
"entryPoints",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"ep",
".",
"getEntryPoint",
"(",
")",
".",
"equals",
"(",
"entryPoint",
")",
")",
"{",
"ep",
".",
"resume",
"(",
")",
";",
"}",
"}",
"}"
] |
Resumes a given entry point type;
@param entryPoint The entry point
|
[
"Resumes",
"a",
"given",
"entry",
"point",
"type",
";"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java#L195-L201
|
158,990
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java
|
RequestController.getControlPoint
|
public synchronized ControlPoint getControlPoint(final String deploymentName, final String entryPointName) {
ControlPointIdentifier id = new ControlPointIdentifier(deploymentName, entryPointName);
ControlPoint ep = entryPoints.get(id);
if (ep == null) {
ep = new ControlPoint(this, deploymentName, entryPointName, trackIndividualControlPoints);
entryPoints.put(id, ep);
}
ep.increaseReferenceCount();
return ep;
}
|
java
|
public synchronized ControlPoint getControlPoint(final String deploymentName, final String entryPointName) {
ControlPointIdentifier id = new ControlPointIdentifier(deploymentName, entryPointName);
ControlPoint ep = entryPoints.get(id);
if (ep == null) {
ep = new ControlPoint(this, deploymentName, entryPointName, trackIndividualControlPoints);
entryPoints.put(id, ep);
}
ep.increaseReferenceCount();
return ep;
}
|
[
"public",
"synchronized",
"ControlPoint",
"getControlPoint",
"(",
"final",
"String",
"deploymentName",
",",
"final",
"String",
"entryPointName",
")",
"{",
"ControlPointIdentifier",
"id",
"=",
"new",
"ControlPointIdentifier",
"(",
"deploymentName",
",",
"entryPointName",
")",
";",
"ControlPoint",
"ep",
"=",
"entryPoints",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"ep",
"==",
"null",
")",
"{",
"ep",
"=",
"new",
"ControlPoint",
"(",
"this",
",",
"deploymentName",
",",
"entryPointName",
",",
"trackIndividualControlPoints",
")",
";",
"entryPoints",
".",
"put",
"(",
"id",
",",
"ep",
")",
";",
"}",
"ep",
".",
"increaseReferenceCount",
"(",
")",
";",
"return",
"ep",
";",
"}"
] |
Gets an entry point for the given deployment. If one does not exist it will be created. If the request controller is disabled
this will return null.
Entry points are reference counted. If this method is called n times then {@link #removeControlPoint(ControlPoint)}
must also be called n times to clean up the entry points.
@param deploymentName The top level deployment name
@param entryPointName The entry point name
@return The entry point, or null if the request controller is disabled
|
[
"Gets",
"an",
"entry",
"point",
"for",
"the",
"given",
"deployment",
".",
"If",
"one",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
".",
"If",
"the",
"request",
"controller",
"is",
"disabled",
"this",
"will",
"return",
"null",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java#L267-L276
|
158,991
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java
|
RequestController.removeControlPoint
|
public synchronized void removeControlPoint(ControlPoint controlPoint) {
if (controlPoint.decreaseReferenceCount() == 0) {
ControlPointIdentifier id = new ControlPointIdentifier(controlPoint.getDeployment(), controlPoint.getEntryPoint());
entryPoints.remove(id);
}
}
|
java
|
public synchronized void removeControlPoint(ControlPoint controlPoint) {
if (controlPoint.decreaseReferenceCount() == 0) {
ControlPointIdentifier id = new ControlPointIdentifier(controlPoint.getDeployment(), controlPoint.getEntryPoint());
entryPoints.remove(id);
}
}
|
[
"public",
"synchronized",
"void",
"removeControlPoint",
"(",
"ControlPoint",
"controlPoint",
")",
"{",
"if",
"(",
"controlPoint",
".",
"decreaseReferenceCount",
"(",
")",
"==",
"0",
")",
"{",
"ControlPointIdentifier",
"id",
"=",
"new",
"ControlPointIdentifier",
"(",
"controlPoint",
".",
"getDeployment",
"(",
")",
",",
"controlPoint",
".",
"getEntryPoint",
"(",
")",
")",
";",
"entryPoints",
".",
"remove",
"(",
"id",
")",
";",
"}",
"}"
] |
Removes the specified entry point
@param controlPoint The entry point
|
[
"Removes",
"the",
"specified",
"entry",
"point"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java#L283-L288
|
158,992
|
wildfly/wildfly-core
|
request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java
|
RequestController.runQueuedTask
|
private boolean runQueuedTask(boolean hasPermit) {
if (!hasPermit && beginRequest(paused) == RunResult.REJECTED) {
return false;
}
QueuedTask task = null;
if (!paused) {
task = taskQueue.poll();
} else {
//the container is suspended, but we still need to run any force queued tasks
task = findForcedTask();
}
if (task != null) {
if(!task.runRequest()) {
decrementRequestCount();
}
return true;
} else {
decrementRequestCount();
return false;
}
}
|
java
|
private boolean runQueuedTask(boolean hasPermit) {
if (!hasPermit && beginRequest(paused) == RunResult.REJECTED) {
return false;
}
QueuedTask task = null;
if (!paused) {
task = taskQueue.poll();
} else {
//the container is suspended, but we still need to run any force queued tasks
task = findForcedTask();
}
if (task != null) {
if(!task.runRequest()) {
decrementRequestCount();
}
return true;
} else {
decrementRequestCount();
return false;
}
}
|
[
"private",
"boolean",
"runQueuedTask",
"(",
"boolean",
"hasPermit",
")",
"{",
"if",
"(",
"!",
"hasPermit",
"&&",
"beginRequest",
"(",
"paused",
")",
"==",
"RunResult",
".",
"REJECTED",
")",
"{",
"return",
"false",
";",
"}",
"QueuedTask",
"task",
"=",
"null",
";",
"if",
"(",
"!",
"paused",
")",
"{",
"task",
"=",
"taskQueue",
".",
"poll",
"(",
")",
";",
"}",
"else",
"{",
"//the container is suspended, but we still need to run any force queued tasks",
"task",
"=",
"findForcedTask",
"(",
")",
";",
"}",
"if",
"(",
"task",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"task",
".",
"runRequest",
"(",
")",
")",
"{",
"decrementRequestCount",
"(",
")",
";",
"}",
"return",
"true",
";",
"}",
"else",
"{",
"decrementRequestCount",
"(",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Runs a queued task, if the queue is not already empty.
Note that this will decrement the request count if there are no queued tasks to be run
@param hasPermit If the caller has already called {@link #beginRequest(boolean force)}
|
[
"Runs",
"a",
"queued",
"task",
"if",
"the",
"queue",
"is",
"not",
"already",
"empty",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/request-controller/src/main/java/org/wildfly/extension/requestcontroller/RequestController.java#L377-L397
|
158,993
|
wildfly/wildfly-core
|
cli/src/main/java/org/jboss/as/cli/operation/impl/DefaultOperationCandidatesProvider.java
|
DefaultOperationCandidatesProvider.getProperty
|
static Property getProperty(String propName, ModelNode attrs) {
String[] arr = propName.split("\\.");
ModelNode attrDescr = attrs;
for (String item : arr) {
// Remove list part.
if (item.endsWith("]")) {
int i = item.indexOf("[");
if (i < 0) {
return null;
}
item = item.substring(0, i);
}
ModelNode descr = attrDescr.get(item);
if (!descr.isDefined()) {
if (attrDescr.has(Util.VALUE_TYPE)) {
ModelNode vt = attrDescr.get(Util.VALUE_TYPE);
if (vt.has(item)) {
attrDescr = vt.get(item);
continue;
}
}
return null;
}
attrDescr = descr;
}
return new Property(propName, attrDescr);
}
|
java
|
static Property getProperty(String propName, ModelNode attrs) {
String[] arr = propName.split("\\.");
ModelNode attrDescr = attrs;
for (String item : arr) {
// Remove list part.
if (item.endsWith("]")) {
int i = item.indexOf("[");
if (i < 0) {
return null;
}
item = item.substring(0, i);
}
ModelNode descr = attrDescr.get(item);
if (!descr.isDefined()) {
if (attrDescr.has(Util.VALUE_TYPE)) {
ModelNode vt = attrDescr.get(Util.VALUE_TYPE);
if (vt.has(item)) {
attrDescr = vt.get(item);
continue;
}
}
return null;
}
attrDescr = descr;
}
return new Property(propName, attrDescr);
}
|
[
"static",
"Property",
"getProperty",
"(",
"String",
"propName",
",",
"ModelNode",
"attrs",
")",
"{",
"String",
"[",
"]",
"arr",
"=",
"propName",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"ModelNode",
"attrDescr",
"=",
"attrs",
";",
"for",
"(",
"String",
"item",
":",
"arr",
")",
"{",
"// Remove list part.",
"if",
"(",
"item",
".",
"endsWith",
"(",
"\"]\"",
")",
")",
"{",
"int",
"i",
"=",
"item",
".",
"indexOf",
"(",
"\"[\"",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"item",
"=",
"item",
".",
"substring",
"(",
"0",
",",
"i",
")",
";",
"}",
"ModelNode",
"descr",
"=",
"attrDescr",
".",
"get",
"(",
"item",
")",
";",
"if",
"(",
"!",
"descr",
".",
"isDefined",
"(",
")",
")",
"{",
"if",
"(",
"attrDescr",
".",
"has",
"(",
"Util",
".",
"VALUE_TYPE",
")",
")",
"{",
"ModelNode",
"vt",
"=",
"attrDescr",
".",
"get",
"(",
"Util",
".",
"VALUE_TYPE",
")",
";",
"if",
"(",
"vt",
".",
"has",
"(",
"item",
")",
")",
"{",
"attrDescr",
"=",
"vt",
".",
"get",
"(",
"item",
")",
";",
"continue",
";",
"}",
"}",
"return",
"null",
";",
"}",
"attrDescr",
"=",
"descr",
";",
"}",
"return",
"new",
"Property",
"(",
"propName",
",",
"attrDescr",
")",
";",
"}"
] |
package for testing purpose
|
[
"package",
"for",
"testing",
"purpose"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/operation/impl/DefaultOperationCandidatesProvider.java#L740-L766
|
158,994
|
wildfly/wildfly-core
|
logging/src/main/java/org/jboss/as/logging/deployments/LoggingConfigDeploymentProcessor.java
|
LoggingConfigDeploymentProcessor.configure
|
private LoggingConfigurationService configure(final ResourceRoot root, final VirtualFile configFile, final ClassLoader classLoader, final LogContext logContext) throws DeploymentUnitProcessingException {
InputStream configStream = null;
try {
LoggingLogger.ROOT_LOGGER.debugf("Found logging configuration file: %s", configFile);
// Get the filname and open the stream
final String fileName = configFile.getName();
configStream = configFile.openStream();
// Check the type of the configuration file
if (isLog4jConfiguration(fileName)) {
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
final LogContext old = logContextSelector.getAndSet(CONTEXT_LOCK, logContext);
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
if (LOG4J_XML.equals(fileName) || JBOSS_LOG4J_XML.equals(fileName)) {
new DOMConfigurator().doConfigure(configStream, org.apache.log4j.JBossLogManagerFacade.getLoggerRepository(logContext));
} else {
final Properties properties = new Properties();
properties.load(new InputStreamReader(configStream, ENCODING));
new org.apache.log4j.PropertyConfigurator().doConfigure(properties, org.apache.log4j.JBossLogManagerFacade.getLoggerRepository(logContext));
}
} finally {
logContextSelector.getAndSet(CONTEXT_LOCK, old);
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
return new LoggingConfigurationService(null, resolveRelativePath(root, configFile));
} else {
// Create a properties file
final Properties properties = new Properties();
properties.load(new InputStreamReader(configStream, ENCODING));
// Attempt to see if this is a J.U.L. configuration file
if (isJulConfiguration(properties)) {
LoggingLogger.ROOT_LOGGER.julConfigurationFileFound(configFile.getName());
} else {
// Load non-log4j types
final PropertyConfigurator propertyConfigurator = new PropertyConfigurator(logContext);
propertyConfigurator.configure(properties);
return new LoggingConfigurationService(propertyConfigurator.getLogContextConfiguration(), resolveRelativePath(root, configFile));
}
}
} catch (Exception e) {
throw LoggingLogger.ROOT_LOGGER.failedToConfigureLogging(e, configFile.getName());
} finally {
safeClose(configStream);
}
return null;
}
|
java
|
private LoggingConfigurationService configure(final ResourceRoot root, final VirtualFile configFile, final ClassLoader classLoader, final LogContext logContext) throws DeploymentUnitProcessingException {
InputStream configStream = null;
try {
LoggingLogger.ROOT_LOGGER.debugf("Found logging configuration file: %s", configFile);
// Get the filname and open the stream
final String fileName = configFile.getName();
configStream = configFile.openStream();
// Check the type of the configuration file
if (isLog4jConfiguration(fileName)) {
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
final LogContext old = logContextSelector.getAndSet(CONTEXT_LOCK, logContext);
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
if (LOG4J_XML.equals(fileName) || JBOSS_LOG4J_XML.equals(fileName)) {
new DOMConfigurator().doConfigure(configStream, org.apache.log4j.JBossLogManagerFacade.getLoggerRepository(logContext));
} else {
final Properties properties = new Properties();
properties.load(new InputStreamReader(configStream, ENCODING));
new org.apache.log4j.PropertyConfigurator().doConfigure(properties, org.apache.log4j.JBossLogManagerFacade.getLoggerRepository(logContext));
}
} finally {
logContextSelector.getAndSet(CONTEXT_LOCK, old);
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
return new LoggingConfigurationService(null, resolveRelativePath(root, configFile));
} else {
// Create a properties file
final Properties properties = new Properties();
properties.load(new InputStreamReader(configStream, ENCODING));
// Attempt to see if this is a J.U.L. configuration file
if (isJulConfiguration(properties)) {
LoggingLogger.ROOT_LOGGER.julConfigurationFileFound(configFile.getName());
} else {
// Load non-log4j types
final PropertyConfigurator propertyConfigurator = new PropertyConfigurator(logContext);
propertyConfigurator.configure(properties);
return new LoggingConfigurationService(propertyConfigurator.getLogContextConfiguration(), resolveRelativePath(root, configFile));
}
}
} catch (Exception e) {
throw LoggingLogger.ROOT_LOGGER.failedToConfigureLogging(e, configFile.getName());
} finally {
safeClose(configStream);
}
return null;
}
|
[
"private",
"LoggingConfigurationService",
"configure",
"(",
"final",
"ResourceRoot",
"root",
",",
"final",
"VirtualFile",
"configFile",
",",
"final",
"ClassLoader",
"classLoader",
",",
"final",
"LogContext",
"logContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"InputStream",
"configStream",
"=",
"null",
";",
"try",
"{",
"LoggingLogger",
".",
"ROOT_LOGGER",
".",
"debugf",
"(",
"\"Found logging configuration file: %s\"",
",",
"configFile",
")",
";",
"// Get the filname and open the stream",
"final",
"String",
"fileName",
"=",
"configFile",
".",
"getName",
"(",
")",
";",
"configStream",
"=",
"configFile",
".",
"openStream",
"(",
")",
";",
"// Check the type of the configuration file",
"if",
"(",
"isLog4jConfiguration",
"(",
"fileName",
")",
")",
"{",
"final",
"ClassLoader",
"current",
"=",
"WildFlySecurityManager",
".",
"getCurrentContextClassLoaderPrivileged",
"(",
")",
";",
"final",
"LogContext",
"old",
"=",
"logContextSelector",
".",
"getAndSet",
"(",
"CONTEXT_LOCK",
",",
"logContext",
")",
";",
"try",
"{",
"WildFlySecurityManager",
".",
"setCurrentContextClassLoaderPrivileged",
"(",
"classLoader",
")",
";",
"if",
"(",
"LOG4J_XML",
".",
"equals",
"(",
"fileName",
")",
"||",
"JBOSS_LOG4J_XML",
".",
"equals",
"(",
"fileName",
")",
")",
"{",
"new",
"DOMConfigurator",
"(",
")",
".",
"doConfigure",
"(",
"configStream",
",",
"org",
".",
"apache",
".",
"log4j",
".",
"JBossLogManagerFacade",
".",
"getLoggerRepository",
"(",
"logContext",
")",
")",
";",
"}",
"else",
"{",
"final",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"load",
"(",
"new",
"InputStreamReader",
"(",
"configStream",
",",
"ENCODING",
")",
")",
";",
"new",
"org",
".",
"apache",
".",
"log4j",
".",
"PropertyConfigurator",
"(",
")",
".",
"doConfigure",
"(",
"properties",
",",
"org",
".",
"apache",
".",
"log4j",
".",
"JBossLogManagerFacade",
".",
"getLoggerRepository",
"(",
"logContext",
")",
")",
";",
"}",
"}",
"finally",
"{",
"logContextSelector",
".",
"getAndSet",
"(",
"CONTEXT_LOCK",
",",
"old",
")",
";",
"WildFlySecurityManager",
".",
"setCurrentContextClassLoaderPrivileged",
"(",
"current",
")",
";",
"}",
"return",
"new",
"LoggingConfigurationService",
"(",
"null",
",",
"resolveRelativePath",
"(",
"root",
",",
"configFile",
")",
")",
";",
"}",
"else",
"{",
"// Create a properties file",
"final",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"load",
"(",
"new",
"InputStreamReader",
"(",
"configStream",
",",
"ENCODING",
")",
")",
";",
"// Attempt to see if this is a J.U.L. configuration file",
"if",
"(",
"isJulConfiguration",
"(",
"properties",
")",
")",
"{",
"LoggingLogger",
".",
"ROOT_LOGGER",
".",
"julConfigurationFileFound",
"(",
"configFile",
".",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"// Load non-log4j types",
"final",
"PropertyConfigurator",
"propertyConfigurator",
"=",
"new",
"PropertyConfigurator",
"(",
"logContext",
")",
";",
"propertyConfigurator",
".",
"configure",
"(",
"properties",
")",
";",
"return",
"new",
"LoggingConfigurationService",
"(",
"propertyConfigurator",
".",
"getLogContextConfiguration",
"(",
")",
",",
"resolveRelativePath",
"(",
"root",
",",
"configFile",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"LoggingLogger",
".",
"ROOT_LOGGER",
".",
"failedToConfigureLogging",
"(",
"e",
",",
"configFile",
".",
"getName",
"(",
")",
")",
";",
"}",
"finally",
"{",
"safeClose",
"(",
"configStream",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Configures the log context.
@param configFile the configuration file
@param classLoader the class loader to use for the configuration
@param logContext the log context to configure
@return {@code true} if the log context was successfully configured, otherwise {@code false}
@throws DeploymentUnitProcessingException if the configuration fails
|
[
"Configures",
"the",
"log",
"context",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/deployments/LoggingConfigDeploymentProcessor.java#L220-L267
|
158,995
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/operations/validation/OperationValidator.java
|
OperationValidator.validateOperations
|
public void validateOperations(final List<ModelNode> operations) {
if (operations == null) {
return;
}
for (ModelNode operation : operations) {
try {
validateOperation(operation);
} catch (RuntimeException e) {
if (exitOnError) {
throw e;
} else {
System.out.println("---- Operation validation error:");
System.out.println(e.getMessage());
}
}
}
}
|
java
|
public void validateOperations(final List<ModelNode> operations) {
if (operations == null) {
return;
}
for (ModelNode operation : operations) {
try {
validateOperation(operation);
} catch (RuntimeException e) {
if (exitOnError) {
throw e;
} else {
System.out.println("---- Operation validation error:");
System.out.println(e.getMessage());
}
}
}
}
|
[
"public",
"void",
"validateOperations",
"(",
"final",
"List",
"<",
"ModelNode",
">",
"operations",
")",
"{",
"if",
"(",
"operations",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"ModelNode",
"operation",
":",
"operations",
")",
"{",
"try",
"{",
"validateOperation",
"(",
"operation",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"if",
"(",
"exitOnError",
")",
"{",
"throw",
"e",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"---- Operation validation error:\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Validates operations against their description providers
@param operations The operations to validate
@throws IllegalArgumentException if any operation is not valid
|
[
"Validates",
"operations",
"against",
"their",
"description",
"providers"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/validation/OperationValidator.java#L97-L115
|
158,996
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/operations/validation/OperationValidator.java
|
OperationValidator.validateOperation
|
public void validateOperation(final ModelNode operation) {
if (operation == null) {
return;
}
final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final String name = operation.get(OP).asString();
OperationEntry entry = root.getOperationEntry(address, name);
if (entry == null) {
throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationEntry(name, address));
}
//noinspection ConstantConditions
if (entry.getType() == EntryType.PRIVATE || entry.getFlags().contains(OperationEntry.Flag.HIDDEN)) {
return;
}
if (entry.getOperationHandler() == null) {
throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationHandler(name, address));
}
final DescriptionProvider provider = getDescriptionProvider(operation);
final ModelNode description = provider.getModelDescription(null);
final Map<String, ModelNode> describedProperties = getDescribedRequestProperties(operation, description);
final Map<String, ModelNode> actualParams = getActualRequestProperties(operation);
checkActualOperationParamsAreDescribed(operation, describedProperties, actualParams);
checkAllRequiredPropertiesArePresent(description, operation, describedProperties, actualParams);
checkParameterTypes(description, operation, describedProperties, actualParams);
//TODO check ranges
}
|
java
|
public void validateOperation(final ModelNode operation) {
if (operation == null) {
return;
}
final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final String name = operation.get(OP).asString();
OperationEntry entry = root.getOperationEntry(address, name);
if (entry == null) {
throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationEntry(name, address));
}
//noinspection ConstantConditions
if (entry.getType() == EntryType.PRIVATE || entry.getFlags().contains(OperationEntry.Flag.HIDDEN)) {
return;
}
if (entry.getOperationHandler() == null) {
throwOrWarnAboutDescriptorProblem(ControllerLogger.ROOT_LOGGER.noOperationHandler(name, address));
}
final DescriptionProvider provider = getDescriptionProvider(operation);
final ModelNode description = provider.getModelDescription(null);
final Map<String, ModelNode> describedProperties = getDescribedRequestProperties(operation, description);
final Map<String, ModelNode> actualParams = getActualRequestProperties(operation);
checkActualOperationParamsAreDescribed(operation, describedProperties, actualParams);
checkAllRequiredPropertiesArePresent(description, operation, describedProperties, actualParams);
checkParameterTypes(description, operation, describedProperties, actualParams);
//TODO check ranges
}
|
[
"public",
"void",
"validateOperation",
"(",
"final",
"ModelNode",
"operation",
")",
"{",
"if",
"(",
"operation",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"PathAddress",
"address",
"=",
"PathAddress",
".",
"pathAddress",
"(",
"operation",
".",
"get",
"(",
"OP_ADDR",
")",
")",
";",
"final",
"String",
"name",
"=",
"operation",
".",
"get",
"(",
"OP",
")",
".",
"asString",
"(",
")",
";",
"OperationEntry",
"entry",
"=",
"root",
".",
"getOperationEntry",
"(",
"address",
",",
"name",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"throwOrWarnAboutDescriptorProblem",
"(",
"ControllerLogger",
".",
"ROOT_LOGGER",
".",
"noOperationEntry",
"(",
"name",
",",
"address",
")",
")",
";",
"}",
"//noinspection ConstantConditions",
"if",
"(",
"entry",
".",
"getType",
"(",
")",
"==",
"EntryType",
".",
"PRIVATE",
"||",
"entry",
".",
"getFlags",
"(",
")",
".",
"contains",
"(",
"OperationEntry",
".",
"Flag",
".",
"HIDDEN",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"entry",
".",
"getOperationHandler",
"(",
")",
"==",
"null",
")",
"{",
"throwOrWarnAboutDescriptorProblem",
"(",
"ControllerLogger",
".",
"ROOT_LOGGER",
".",
"noOperationHandler",
"(",
"name",
",",
"address",
")",
")",
";",
"}",
"final",
"DescriptionProvider",
"provider",
"=",
"getDescriptionProvider",
"(",
"operation",
")",
";",
"final",
"ModelNode",
"description",
"=",
"provider",
".",
"getModelDescription",
"(",
"null",
")",
";",
"final",
"Map",
"<",
"String",
",",
"ModelNode",
">",
"describedProperties",
"=",
"getDescribedRequestProperties",
"(",
"operation",
",",
"description",
")",
";",
"final",
"Map",
"<",
"String",
",",
"ModelNode",
">",
"actualParams",
"=",
"getActualRequestProperties",
"(",
"operation",
")",
";",
"checkActualOperationParamsAreDescribed",
"(",
"operation",
",",
"describedProperties",
",",
"actualParams",
")",
";",
"checkAllRequiredPropertiesArePresent",
"(",
"description",
",",
"operation",
",",
"describedProperties",
",",
"actualParams",
")",
";",
"checkParameterTypes",
"(",
"description",
",",
"operation",
",",
"describedProperties",
",",
"actualParams",
")",
";",
"//TODO check ranges",
"}"
] |
Validates an operation against its description provider
@param operation The operation to validate
@throws IllegalArgumentException if the operation is not valid
|
[
"Validates",
"an",
"operation",
"against",
"its",
"description",
"provider"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/validation/OperationValidator.java#L123-L152
|
158,997
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/operations/validation/OperationValidator.java
|
OperationValidator.throwOrWarnAboutDescriptorProblem
|
private void throwOrWarnAboutDescriptorProblem(String message) {
if (validateDescriptions) {
throw new IllegalArgumentException(message);
}
ControllerLogger.ROOT_LOGGER.warn(message);
}
|
java
|
private void throwOrWarnAboutDescriptorProblem(String message) {
if (validateDescriptions) {
throw new IllegalArgumentException(message);
}
ControllerLogger.ROOT_LOGGER.warn(message);
}
|
[
"private",
"void",
"throwOrWarnAboutDescriptorProblem",
"(",
"String",
"message",
")",
"{",
"if",
"(",
"validateDescriptions",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"ControllerLogger",
".",
"ROOT_LOGGER",
".",
"warn",
"(",
"message",
")",
";",
"}"
] |
Throws an exception or logs a message
@param message The message for the exception or the log message. Must be internationalized
|
[
"Throws",
"an",
"exception",
"or",
"logs",
"a",
"message"
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/validation/OperationValidator.java#L565-L570
|
158,998
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/capability/RuntimeCapability.java
|
RuntimeCapability.buildDynamicCapabilityName
|
public static String buildDynamicCapabilityName(String baseName, String dynamicNameElement) {
return buildDynamicCapabilityName(baseName, new String[]{dynamicNameElement});
}
|
java
|
public static String buildDynamicCapabilityName(String baseName, String dynamicNameElement) {
return buildDynamicCapabilityName(baseName, new String[]{dynamicNameElement});
}
|
[
"public",
"static",
"String",
"buildDynamicCapabilityName",
"(",
"String",
"baseName",
",",
"String",
"dynamicNameElement",
")",
"{",
"return",
"buildDynamicCapabilityName",
"(",
"baseName",
",",
"new",
"String",
"[",
"]",
"{",
"dynamicNameElement",
"}",
")",
";",
"}"
] |
todo remove, here only for binary compatibility of elytron subsystem, drop once it is in.
|
[
"todo",
"remove",
"here",
"only",
"for",
"binary",
"compatibility",
"of",
"elytron",
"subsystem",
"drop",
"once",
"it",
"is",
"in",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/RuntimeCapability.java#L46-L48
|
158,999
|
wildfly/wildfly-core
|
controller/src/main/java/org/jboss/as/controller/capability/RuntimeCapability.java
|
RuntimeCapability.buildDynamicCapabilityName
|
public static String buildDynamicCapabilityName(String baseName, String ... dynamicNameElement) {
assert baseName != null;
assert dynamicNameElement != null;
assert dynamicNameElement.length > 0;
StringBuilder sb = new StringBuilder(baseName);
for (String part:dynamicNameElement){
sb.append(".").append(part);
}
return sb.toString();
}
|
java
|
public static String buildDynamicCapabilityName(String baseName, String ... dynamicNameElement) {
assert baseName != null;
assert dynamicNameElement != null;
assert dynamicNameElement.length > 0;
StringBuilder sb = new StringBuilder(baseName);
for (String part:dynamicNameElement){
sb.append(".").append(part);
}
return sb.toString();
}
|
[
"public",
"static",
"String",
"buildDynamicCapabilityName",
"(",
"String",
"baseName",
",",
"String",
"...",
"dynamicNameElement",
")",
"{",
"assert",
"baseName",
"!=",
"null",
";",
"assert",
"dynamicNameElement",
"!=",
"null",
";",
"assert",
"dynamicNameElement",
".",
"length",
">",
"0",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"baseName",
")",
";",
"for",
"(",
"String",
"part",
":",
"dynamicNameElement",
")",
"{",
"sb",
".",
"append",
"(",
"\".\"",
")",
".",
"append",
"(",
"part",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Constructs a full capability name from a static base name and a dynamic element.
@param baseName the base name. Cannot be {@code null}
@param dynamicNameElement the dynamic portion of the name. Cannot be {@code null}
@return the full capability name. Will not return {@code null}
|
[
"Constructs",
"a",
"full",
"capability",
"name",
"from",
"a",
"static",
"base",
"name",
"and",
"a",
"dynamic",
"element",
"."
] |
cfaf0479dcbb2d320a44c5374b93b944ec39fade
|
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/RuntimeCapability.java#L63-L72
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.