_id
stringlengths 2
7
| title
stringlengths 3
140
| partition
stringclasses 3
values | text
stringlengths 73
34.1k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q2400
|
DeploymentOverlayHandler.getName
|
train
|
private String getName(CommandContext ctx, boolean failInBatch) throws CommandLineException {
final ParsedCommandLine args = ctx.getParsedCommandLine();
final String name = this.name.getValue(args, true);
if (name == null) {
throw new CommandFormatException(this.name + " is missing value.");
}
if (!ctx.isBatchMode() || failInBatch) {
if (!Util.isValidPath(ctx.getModelControllerClient(), Util.DEPLOYMENT_OVERLAY, name)) {
throw new CommandFormatException("Deployment overlay " + name + " does not exist.");
}
}
return name;
}
|
java
|
{
"resource": ""
}
|
q2401
|
ServiceModuleLoader.moduleSpecServiceName
|
train
|
public static ServiceName moduleSpecServiceName(ModuleIdentifier identifier) {
if (!isDynamicModule(identifier)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_SPEC_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
}
|
java
|
{
"resource": ""
}
|
q2402
|
ServiceModuleLoader.moduleResolvedServiceName
|
train
|
public static ServiceName moduleResolvedServiceName(ModuleIdentifier identifier) {
if (!isDynamicModule(identifier)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_RESOLVED_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
}
|
java
|
{
"resource": ""
}
|
q2403
|
ServiceModuleLoader.moduleServiceName
|
train
|
public static ServiceName moduleServiceName(ModuleIdentifier identifier) {
if (!identifier.getName().startsWith(MODULE_PREFIX)) {
throw ServerLogger.ROOT_LOGGER.missingModulePrefix(identifier, MODULE_PREFIX);
}
return MODULE_SERVICE_PREFIX.append(identifier.getName()).append(identifier.getSlot());
}
|
java
|
{
"resource": ""
}
|
q2404
|
ServiceActivatorProcessor.deploy
|
train
|
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);
if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
return; // Skip it if it has not been marked
}
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module == null) {
return; // Skip deployments with no module
}
AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);
List<String> serviceAcitvatorList = new ArrayList<String>();
if (duList!=null && !duList.isEmpty()) {
for (DeploymentUnit du : duList) {
ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES);
for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
serviceAcitvatorList.add(serv);
}
}
}
ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
if (WildFlySecurityManager.isChecking()) {
//service registry allows you to modify internal server state across all deployments
//if a security manager is present we use a version that has permission checks
serviceRegistry = new SecuredServiceRegistry(serviceRegistry);
}
final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) {
try {
for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) {
serviceActivator.activate(serviceActivatorContext);
break;
}
}
} catch (ServiceRegistryException e) {
throw new DeploymentUnitProcessingException(e);
}
}
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
|
java
|
{
"resource": ""
}
|
q2405
|
HostControllerConnection.openConnection
|
train
|
synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception {
boolean ok = false;
final Connection connection = connectionManager.connect();
try {
channelHandler.executeRequest(new ServerRegisterRequest(), null, callback);
// HC is the same version, so it will support sending the subject
channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE);
channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IN_VM, Boolean.TRUE);
channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport));
ok = true;
} finally {
if(!ok) {
connection.close();
}
}
}
|
java
|
{
"resource": ""
}
|
q2406
|
HostControllerConnection.asyncReconnect
|
train
|
synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) {
if (getState() != State.OPEN) {
return;
}
// Update the configuration with the new credentials
final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration);
config.setCallbackHandler(createClientCallbackHandler(userName, authKey));
config.setUri(reconnectUri);
this.configuration = config;
final ReconnectRunner reconnectTask = this.reconnectRunner;
if (reconnectTask == null) {
final ReconnectRunner task = new ReconnectRunner();
task.callback = callback;
task.future = executorService.submit(task);
} else {
reconnectTask.callback = callback;
}
}
|
java
|
{
"resource": ""
}
|
q2407
|
HostControllerConnection.doReConnect
|
train
|
synchronized boolean doReConnect() throws IOException {
// In case we are still connected, test the connection and see if we can reuse it
if(connectionManager.isConnected()) {
try {
final Future<Long> result = channelHandler.executeRequest(ManagementPingRequest.INSTANCE, null).getResult();
result.get(15, TimeUnit.SECONDS); // Hmm, perhaps 15 is already too much
return true;
} catch (Exception e) {
ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to ping the host-controller, going to reconnect");
}
// Disconnect - the HC might have closed the connection without us noticing and is asking for a reconnect
final Connection connection = connectionManager.getConnection();
StreamUtils.safeClose(connection);
if(connection != null) {
try {
// Wait for the connection to be closed
connection.awaitClosed();
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
}
}
boolean ok = false;
final Connection connection = connectionManager.connect();
try {
// Reconnect to the host-controller
final ActiveOperation<Boolean, Void> result = channelHandler.executeRequest(new ServerReconnectRequest(), null);
try {
boolean inSync = result.getResult().get();
ok = true;
reconnectRunner = null;
return inSync;
} catch (ExecutionException e) {
throw new IOException(e);
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
} finally {
if(!ok) {
StreamUtils.safeClose(connection);
}
}
}
|
java
|
{
"resource": ""
}
|
q2408
|
HostControllerConnection.started
|
train
|
synchronized void started() {
try {
if(isConnected()) {
channelHandler.executeRequest(new ServerStartedRequest(), null).getResult().await();
}
} catch (Exception e) {
ServerLogger.AS_ROOT_LOGGER.debugf(e, "failed to send started notification");
}
}
|
java
|
{
"resource": ""
}
|
q2409
|
ServerTaskExecutor.executeTask
|
train
|
public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) {
try {
return execute(listener, task.getServerIdentity(), task.getOperation());
} catch (OperationFailedException e) {
// Handle failures operation transformation failures
final ServerIdentity identity = task.getServerIdentity();
final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT);
final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
listener.operationPrepared(result);
recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT));
return 1; // 1 ms timeout since there is no reason to wait for the locally stored result
}
}
|
java
|
{
"resource": ""
}
|
q2410
|
ServerTaskExecutor.executeOperation
|
train
|
protected boolean executeOperation(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, TransactionalProtocolClient client, final ServerIdentity identity, final ModelNode operation, final OperationResultTransformer transformer) {
if(client == null) {
return false;
}
final OperationMessageHandler messageHandler = new DelegatingMessageHandler(context);
final OperationAttachments operationAttachments = new DelegatingOperationAttachments(context);
final ServerOperation serverOperation = new ServerOperation(identity, operation, messageHandler, operationAttachments, transformer);
try {
DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Sending %s to %s", operation, identity);
final Future<OperationResponse> result = client.execute(listener, serverOperation);
recordExecutedRequest(new ExecutedServerRequest(identity, result, transformer));
} catch (IOException e) {
final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e);
listener.operationPrepared(result);
recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), transformer));
}
return true;
}
|
java
|
{
"resource": ""
}
|
q2411
|
ServerTaskExecutor.recordPreparedOperation
|
train
|
void recordPreparedOperation(final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> preparedOperation) {
recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(preparedOperation));
}
|
java
|
{
"resource": ""
}
|
q2412
|
ServerTaskExecutor.recordOperationPrepareTimeout
|
train
|
void recordOperationPrepareTimeout(final BlockingQueueOperationListener.FailedOperation<ServerOperation> failedOperation) {
recordPreparedTask(new ServerTaskExecutor.ServerPreparedResponse(failedOperation));
// Swap out the submitted task so we don't wait for the final result. Use a future the returns
// prepared response
ServerIdentity identity = failedOperation.getOperation().getIdentity();
AsyncFuture<OperationResponse> finalResult = failedOperation.getFinalResult();
synchronized (submittedTasks) {
submittedTasks.put(identity, new ServerTaskExecutor.ExecutedServerRequest(identity, finalResult));
}
}
|
java
|
{
"resource": ""
}
|
q2413
|
InstallationManagerService.installService
|
train
|
public static ServiceController<InstallationManager> installService(ServiceTarget serviceTarget) {
final InstallationManagerService service = new InstallationManagerService();
return serviceTarget.addService(InstallationManagerService.NAME, service)
.addDependency(JBOSS_PRODUCT_CONFIG_SERVICE, ProductConfig.class, service.productConfig)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
|
java
|
{
"resource": ""
}
|
q2414
|
ClassReflectionIndex.getMethod
|
train
|
public Method getMethod(Method method) {
return getMethod(method.getReturnType(), method.getName(), method.getParameterTypes());
}
|
java
|
{
"resource": ""
}
|
q2415
|
ClassReflectionIndex.getAllMethods
|
train
|
public Collection<Method> getAllMethods(String name) {
final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name);
if (nameMap == null) {
return Collections.emptySet();
}
final Collection<Method> methods = new ArrayList<Method>();
for (Map<Class<?>, Method> map : nameMap.values()) {
methods.addAll(map.values());
}
return methods;
}
|
java
|
{
"resource": ""
}
|
q2416
|
ClassReflectionIndex.getAllMethods
|
train
|
public Collection<Method> getAllMethods(String name, int paramCount) {
final Map<ParamList, Map<Class<?>, Method>> nameMap = methods.get(name);
if (nameMap == null) {
return Collections.emptySet();
}
final Collection<Method> methods = new ArrayList<Method>();
for (Map<Class<?>, Method> map : nameMap.values()) {
for (Method method : map.values()) {
if (method.getParameterTypes().length == paramCount) {
methods.add(method);
}
}
}
return methods;
}
|
java
|
{
"resource": ""
}
|
q2417
|
DomainServerCommunicationServices.create
|
train
|
public static ServiceActivator create(final ModelNode endpointConfig, final URI managementURI, final String serverName, final String serverProcessName,
final String authKey, final boolean managementSubsystemEndpoint, final Supplier<SSLContext> sslContextSupplier) {
return new DomainServerCommunicationServices(endpointConfig, managementURI, serverName, serverProcessName, authKey, managementSubsystemEndpoint, sslContextSupplier);
}
|
java
|
{
"resource": ""
}
|
q2418
|
SocketBinding.getMulticastSocketAddress
|
train
|
public InetSocketAddress getMulticastSocketAddress() {
if (multicastAddress == null) {
throw MESSAGES.noMulticastBinding(name);
}
return new InetSocketAddress(multicastAddress, multicastPort);
}
|
java
|
{
"resource": ""
}
|
q2419
|
SocketBinding.createServerSocket
|
train
|
public ServerSocket createServerSocket() throws IOException {
final ServerSocket socket = getServerSocketFactory().createServerSocket(name);
socket.bind(getSocketAddress());
return socket;
}
|
java
|
{
"resource": ""
}
|
q2420
|
LoggingDeploymentResources.registerDeploymentResource
|
train
|
public static void registerDeploymentResource(final DeploymentResourceSupport deploymentResourceSupport, final LoggingConfigurationService service) {
final PathElement base = PathElement.pathElement("configuration", service.getConfiguration());
deploymentResourceSupport.getDeploymentSubModel(LoggingExtension.SUBSYSTEM_NAME, base);
final LogContextConfiguration configuration = service.getValue();
// Register the child resources if the configuration is not null in cases where a log4j configuration was used
if (configuration != null) {
registerDeploymentResource(deploymentResourceSupport, base, HANDLER, configuration.getHandlerNames());
registerDeploymentResource(deploymentResourceSupport, base, LOGGER, configuration.getLoggerNames());
registerDeploymentResource(deploymentResourceSupport, base, FORMATTER, configuration.getFormatterNames());
registerDeploymentResource(deploymentResourceSupport, base, FILTER, configuration.getFilterNames());
registerDeploymentResource(deploymentResourceSupport, base, POJO, configuration.getPojoNames());
registerDeploymentResource(deploymentResourceSupport, base, ERROR_MANAGER, configuration.getErrorManagerNames());
}
}
|
java
|
{
"resource": ""
}
|
q2421
|
DomainUtil.constructUrl
|
train
|
public static String constructUrl(final HttpServerExchange exchange, final String path) {
final HeaderMap headers = exchange.getRequestHeaders();
String host = headers.getFirst(HOST);
String protocol = exchange.getConnection().getSslSessionInfo() != null ? "https" : "http";
return protocol + "://" + host + path;
}
|
java
|
{
"resource": ""
}
|
q2422
|
PathElement.matches
|
train
|
public boolean matches(Property property) {
return property.getName().equals(key) && (value == WILDCARD_VALUE || property.getValue().asString().equals(value));
}
|
java
|
{
"resource": ""
}
|
q2423
|
PathElement.matches
|
train
|
public boolean matches(PathElement pe) {
return pe.key.equals(key) && (isWildcard() || pe.value.equals(value));
}
|
java
|
{
"resource": ""
}
|
q2424
|
Log4jAppenderHandler.setAppender
|
train
|
public void setAppender(final Appender appender) {
if (this.appender != null) {
close();
}
checkAccess(this);
if (applyLayout && appender != null) {
final Formatter formatter = getFormatter();
appender.setLayout(formatter == null ? null : new FormatterLayout(formatter));
}
appenderUpdater.set(this, appender);
}
|
java
|
{
"resource": ""
}
|
q2425
|
AbstractInstallationReporter.createOSNode
|
train
|
private ModelNode createOSNode() throws OperationFailedException {
String osName = getProperty("os.name");
final ModelNode os = new ModelNode();
if (osName != null && osName.toLowerCase().contains("linux")) {
try {
os.set(GnuLinuxDistribution.discover());
} catch (IOException ex) {
throw new OperationFailedException(ex);
}
} else {
os.set(osName);
}
return os;
}
|
java
|
{
"resource": ""
}
|
q2426
|
AbstractInstallationReporter.createJVMNode
|
train
|
private ModelNode createJVMNode() throws OperationFailedException {
ModelNode jvm = new ModelNode().setEmptyObject();
jvm.get(NAME).set(getProperty("java.vm.name"));
jvm.get(JAVA_VERSION).set(getProperty("java.vm.specification.version"));
jvm.get(JVM_VERSION).set(getProperty("java.version"));
jvm.get(JVM_VENDOR).set(getProperty("java.vm.vendor"));
jvm.get(JVM_HOME).set(getProperty("java.home"));
return jvm;
}
|
java
|
{
"resource": ""
}
|
q2427
|
AbstractInstallationReporter.createCPUNode
|
train
|
private ModelNode createCPUNode() throws OperationFailedException {
ModelNode cpu = new ModelNode().setEmptyObject();
cpu.get(ARCH).set(getProperty("os.arch"));
cpu.get(AVAILABLE_PROCESSORS).set(ProcessorInfo.availableProcessors());
return cpu;
}
|
java
|
{
"resource": ""
}
|
q2428
|
AbstractInstallationReporter.getProperty
|
train
|
private String getProperty(String name) {
return System.getSecurityManager() == null ? System.getProperty(name) : doPrivileged(new ReadPropertyAction(name));
}
|
java
|
{
"resource": ""
}
|
q2429
|
ManagementModelNode.explore
|
train
|
public void explore() {
if (isLeaf) return;
if (isGeneric) return;
removeAllChildren();
try {
String addressPath = addressPath();
ModelNode resourceDesc = executor.doCommand(addressPath + ":read-resource-description");
resourceDesc = resourceDesc.get("result");
ModelNode response = executor.doCommand(addressPath + ":read-resource(include-runtime=true,include-defaults=true)");
ModelNode result = response.get("result");
if (!result.isDefined()) return;
List<String> childrenTypes = getChildrenTypes(addressPath);
for (ModelNode node : result.asList()) {
Property prop = node.asProperty();
if (childrenTypes.contains(prop.getName())) { // resource node
if (hasGenericOperations(addressPath, prop.getName())) {
add(new ManagementModelNode(cliGuiCtx, new UserObject(node, prop.getName())));
}
if (prop.getValue().isDefined()) {
for (ModelNode innerNode : prop.getValue().asList()) {
UserObject usrObj = new UserObject(innerNode, prop.getName(), innerNode.asProperty().getName());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} else { // attribute node
UserObject usrObj = new UserObject(node, resourceDesc, prop.getName(), prop.getValue().asString());
add(new ManagementModelNode(cliGuiCtx, usrObj));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
|
java
|
{
"resource": ""
}
|
q2430
|
ManagementModelNode.addressPath
|
train
|
public String addressPath() {
if (isLeaf) {
ManagementModelNode parent = (ManagementModelNode)getParent();
return parent.addressPath();
}
StringBuilder builder = new StringBuilder();
for (Object pathElement : getUserObjectPath()) {
UserObject userObj = (UserObject)pathElement;
if (userObj.isRoot()) { // don't want to escape root
builder.append(userObj.getName());
continue;
}
builder.append(userObj.getName());
builder.append("=");
builder.append(userObj.getEscapedValue());
builder.append("/");
}
return builder.toString();
}
|
java
|
{
"resource": ""
}
|
q2431
|
NetworkUtils.mayBeIPv6Address
|
train
|
private static boolean mayBeIPv6Address(String input) {
if (input == null) {
return false;
}
boolean result = false;
int colonsCounter = 0;
int length = input.length();
for (int i = 0; i < length; i++) {
char c = input.charAt(i);
if (c == '.' || c == '%') {
// IPv4 in IPv6 or Zone ID detected, end of checking.
break;
}
if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f')
|| (c >= 'A' && c <= 'F') || c == ':')) {
return false;
} else if (c == ':') {
colonsCounter++;
}
}
if (colonsCounter >= 2) {
result = true;
}
return result;
}
|
java
|
{
"resource": ""
}
|
q2432
|
DomainTransformers.initializeDomainRegistry
|
train
|
public static void initializeDomainRegistry(final TransformerRegistry registry) {
//The chains for transforming will be as follows
//For JBoss EAP: 8.0.0 -> 5.0.0 -> 4.0.0 -> 1.8.0 -> 1.7.0 -> 1.6.0 -> 1.5.0
registerRootTransformers(registry);
registerChainedManagementTransformers(registry);
registerChainedServerGroupTransformers(registry);
registerProfileTransformers(registry);
registerSocketBindingGroupTransformers(registry);
registerDeploymentTransformers(registry);
}
|
java
|
{
"resource": ""
}
|
q2433
|
ProcessUtils.killProcess
|
train
|
static boolean killProcess(final String processName, int id) {
int pid;
try {
pid = processUtils.resolveProcessId(processName, id);
if(pid > 0) {
try {
Runtime.getRuntime().exec(processUtils.getKillCommand(pid));
return true;
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to kill process '%s' with pid '%s'", processName, pid);
}
}
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to resolve pid of process '%s'", processName);
}
return false;
}
|
java
|
{
"resource": ""
}
|
q2434
|
Launcher.addEnvironmentVariable
|
train
|
public Launcher addEnvironmentVariable(final String key, final String value) {
env.put(key, value);
return this;
}
|
java
|
{
"resource": ""
}
|
q2435
|
RemotingTransformers.buildTransformers_3_0
|
train
|
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
|
{
"resource": ""
}
|
q2436
|
RemotingTransformers.buildTransformers_4_0
|
train
|
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
|
{
"resource": ""
}
|
q2437
|
ManagedServer.getState
|
train
|
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
|
{
"resource": ""
}
|
q2438
|
ManagedServer.reload
|
train
|
synchronized boolean reload(int permit, boolean suspend) {
return internalSetState(new ReloadTask(permit, suspend), InternalState.SERVER_STARTED, InternalState.RELOADING);
}
|
java
|
{
"resource": ""
}
|
q2439
|
ManagedServer.start
|
train
|
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
|
{
"resource": ""
}
|
q2440
|
ManagedServer.stop
|
train
|
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
|
{
"resource": ""
}
|
q2441
|
ManagedServer.reconnectServerProcess
|
train
|
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
|
{
"resource": ""
}
|
q2442
|
ManagedServer.removeServerProcess
|
train
|
synchronized void removeServerProcess() {
this.requiredState = InternalState.STOPPED;
internalSetState(new ProcessRemoveTask(), InternalState.STOPPED, InternalState.PROCESS_REMOVING);
}
|
java
|
{
"resource": ""
}
|
q2443
|
ManagedServer.setServerProcessStopping
|
train
|
synchronized void setServerProcessStopping() {
this.requiredState = InternalState.STOPPED;
internalSetState(null, InternalState.STOPPED, InternalState.PROCESS_STOPPING);
}
|
java
|
{
"resource": ""
}
|
q2444
|
ManagedServer.awaitState
|
train
|
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
|
{
"resource": ""
}
|
q2445
|
ManagedServer.processUnstable
|
train
|
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
|
{
"resource": ""
}
|
q2446
|
ManagedServer.callbackUnregistered
|
train
|
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
|
{
"resource": ""
}
|
q2447
|
ManagedServer.processFinished
|
train
|
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
|
{
"resource": ""
}
|
q2448
|
ManagedServer.transitionFailed
|
train
|
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
|
{
"resource": ""
}
|
q2449
|
ManagedServer.finishTransition
|
train
|
private synchronized void finishTransition(final InternalState current, final InternalState next) {
internalSetState(getTransitionTask(next), current, next);
transition();
}
|
java
|
{
"resource": ""
}
|
q2450
|
SimpleResourceDefinition.registerCapabilities
|
train
|
@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
|
{
"resource": ""
}
|
q2451
|
SimpleResourceDefinition.registerAddOperation
|
train
|
@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
|
{
"resource": ""
}
|
q2452
|
ManagementChannelReceiver.handlePing
|
train
|
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
|
{
"resource": ""
}
|
q2453
|
CLIExpressionResolver.resolveOrOriginal
|
train
|
public static String resolveOrOriginal(String input) {
try {
return resolve(input, true);
} catch (UnresolvedExpressionException e) {
return input;
}
}
|
java
|
{
"resource": ""
}
|
q2454
|
AbstractModelControllerClient.executeForResult
|
train
|
private OperationResponse executeForResult(final OperationExecutionContext executionContext) throws IOException {
try {
return execute(executionContext).get();
} catch(Exception e) {
throw new IOException(e);
}
}
|
java
|
{
"resource": ""
}
|
q2455
|
LayersConfig.getLayersConfig
|
train
|
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
|
{
"resource": ""
}
|
q2456
|
HostXml_Legacy.parseRemoteDomainControllerAttributes_1_5
|
train
|
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
|
{
"resource": ""
}
|
q2457
|
RemoteProxyController.create
|
train
|
public static RemoteProxyController create(final TransactionalProtocolClient client, final PathAddress pathAddress,
final ProxyOperationAddressTranslator addressTranslator,
final ModelVersion targetKernelVersion) {
return new RemoteProxyController(client, pathAddress, addressTranslator, targetKernelVersion);
}
|
java
|
{
"resource": ""
}
|
q2458
|
RemoteProxyController.create
|
train
|
@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
|
{
"resource": ""
}
|
q2459
|
RemoteProxyController.translateOperationForProxy
|
train
|
public ModelNode translateOperationForProxy(final ModelNode op) {
return translateOperationForProxy(op, PathAddress.pathAddress(op.get(OP_ADDR)));
}
|
java
|
{
"resource": ""
}
|
q2460
|
BaseNCodecOutputStream.flush
|
train
|
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
|
{
"resource": ""
}
|
q2461
|
BaseNCodecOutputStream.close
|
train
|
@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
|
{
"resource": ""
}
|
q2462
|
ExpressionResolverImpl.resolveExpressionsRecursively
|
train
|
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
|
{
"resource": ""
}
|
q2463
|
ExpressionResolverImpl.resolveExpressionStringRecursively
|
train
|
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
|
{
"resource": ""
}
|
q2464
|
ExpressionResolverImpl.resolveExpressionString
|
train
|
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
|
{
"resource": ""
}
|
q2465
|
PermissionsParser.unexpectedElement
|
train
|
private static XMLStreamException unexpectedElement(final XMLStreamReader reader) {
return SecurityManagerLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), reader.getLocation());
}
|
java
|
{
"resource": ""
}
|
q2466
|
PermissionsParser.unexpectedAttribute
|
train
|
private static XMLStreamException unexpectedAttribute(final XMLStreamReader reader, final int index) {
return SecurityManagerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation());
}
|
java
|
{
"resource": ""
}
|
q2467
|
DeploymentUploadUtil.storeContentAndTransformOperation
|
train
|
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
|
{
"resource": ""
}
|
q2468
|
DeploymentUploadUtil.explodeContentAndTransformOperation
|
train
|
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
|
{
"resource": ""
}
|
q2469
|
DeploymentUploadUtil.addContentToExplodedAndTransformOperation
|
train
|
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
|
{
"resource": ""
}
|
q2470
|
DeploymentUploadUtil.removeContentFromExplodedAndTransformOperation
|
train
|
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
|
{
"resource": ""
}
|
q2471
|
DeploymentUploadUtil.synchronizeSlaveHostController
|
train
|
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
|
{
"resource": ""
}
|
q2472
|
AnnotationIndexProcessor.deploy
|
train
|
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
for (ResourceRoot resourceRoot : DeploymentUtils.allResourceRoots(deploymentUnit)) {
ResourceRootIndexer.indexResourceRoot(resourceRoot);
}
}
|
java
|
{
"resource": ""
}
|
q2473
|
IoUtils.newFile
|
train
|
public static File newFile(File baseDir, String... segments) {
File f = baseDir;
for (String segment : segments) {
f = new File(f, segment);
}
return f;
}
|
java
|
{
"resource": ""
}
|
q2474
|
PasswordCheckUtil.check
|
train
|
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
|
{
"resource": ""
}
|
q2475
|
ServerGroupChooser.getCmdLineArg
|
train
|
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
|
{
"resource": ""
}
|
q2476
|
ZipCompletionScanner.isCompleteZip
|
train
|
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
|
{
"resource": ""
}
|
q2477
|
ZipCompletionScanner.scanForEndSig
|
train
|
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
|
{
"resource": ""
}
|
q2478
|
HostControllerRegistrationHandler.sendFailedResponse
|
train
|
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
|
{
"resource": ""
}
|
q2479
|
InterfaceDefinition.isOperationDefined
|
train
|
public static boolean isOperationDefined(final ModelNode operation) {
for (final AttributeDefinition def : ROOT_ATTRIBUTES) {
if (operation.hasDefined(def.getName())) {
return true;
}
}
return false;
}
|
java
|
{
"resource": ""
}
|
q2480
|
InterfaceDefinition.wrapAsList
|
train
|
@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
|
{
"resource": ""
}
|
q2481
|
BlockingTimeoutImpl.resolveDomainTimeoutAdder
|
train
|
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
|
{
"resource": ""
}
|
q2482
|
TransformerRegistry.getDomainRegistration
|
train
|
public TransformersSubRegistration getDomainRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS;
return new TransformersSubRegistrationImpl(range, domain, address);
}
|
java
|
{
"resource": ""
}
|
q2483
|
TransformerRegistry.getHostRegistration
|
train
|
public TransformersSubRegistration getHostRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST);
return new TransformersSubRegistrationImpl(range, domain, address);
}
|
java
|
{
"resource": ""
}
|
q2484
|
TransformerRegistry.getServerRegistration
|
train
|
public TransformersSubRegistration getServerRegistration(final ModelVersionRange range) {
final PathAddress address = PathAddress.EMPTY_ADDRESS.append(HOST, SERVER);
return new TransformersSubRegistrationImpl(range, domain, address);
}
|
java
|
{
"resource": ""
}
|
q2485
|
TransformerRegistry.resolveServer
|
train
|
public OperationTransformerRegistry resolveServer(final ModelVersion mgmtVersion, final ModelNode subsystems) {
return resolveServer(mgmtVersion, resolveVersions(subsystems));
}
|
java
|
{
"resource": ""
}
|
q2486
|
TransformerRegistry.addSubsystem
|
train
|
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
|
{
"resource": ""
}
|
q2487
|
PropertiesFileLoader.persistProperties
|
train
|
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
|
{
"resource": ""
}
|
q2488
|
PropertiesFileLoader.addLineContent
|
train
|
protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException {
content.add(line);
}
|
java
|
{
"resource": ""
}
|
q2489
|
PropertiesFileLoader.endPersistence
|
train
|
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
|
{
"resource": ""
}
|
q2490
|
ServicesAttachment.getServiceImplementations
|
train
|
public List<String> getServiceImplementations(String serviceTypeName) {
final List<String> strings = services.get(serviceTypeName);
return strings == null ? Collections.<String>emptyList() : Collections.unmodifiableList(strings);
}
|
java
|
{
"resource": ""
}
|
q2491
|
EmbeddedLogContext.configureLogContext
|
train
|
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
|
{
"resource": ""
}
|
q2492
|
EmbeddedLogContext.clearLogContext
|
train
|
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
|
{
"resource": ""
}
|
q2493
|
CorsUtil.matchOrigin
|
train
|
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
|
{
"resource": ""
}
|
q2494
|
DeploymentReflectionIndex.create
|
train
|
public static DeploymentReflectionIndex create() {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ServerPermission.CREATE_DEPLOYMENT_REFLECTION_INDEX);
}
return new DeploymentReflectionIndex();
}
|
java
|
{
"resource": ""
}
|
q2495
|
AbstractResourceRegistration.getOperationDescriptions
|
train
|
@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
|
{
"resource": ""
}
|
q2496
|
AbstractResourceRegistration.hasNoAlternativeWildcardRegistration
|
train
|
boolean hasNoAlternativeWildcardRegistration() {
return parent == null || PathElement.WILDCARD_VALUE.equals(valueString) || !parent.getChildNames().contains(PathElement.WILDCARD_VALUE);
}
|
java
|
{
"resource": ""
}
|
q2497
|
CLIAccessControl.getAccessControl
|
train
|
public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) {
return getAccessControl(client, null, address, operations);
}
|
java
|
{
"resource": ""
}
|
q2498
|
SynopsisGenerator.generateSynopsis
|
train
|
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
|
{
"resource": ""
}
|
q2499
|
InstalledIdentity.load
|
train
|
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
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.