Skip to content

Commit

Permalink
Merge branch 'ladybird' into invocation_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
darranl committed Jan 21, 2017
2 parents eef933f + fbf7e00 commit ca81bac
Show file tree
Hide file tree
Showing 175 changed files with 3,285 additions and 2,041 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ public void writeContent(final XMLExtendedStreamWriter writer, final SubsystemMa
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
final ModelNode model = context.getModelNode();
BatchSubsystemDefinition.DEFAULT_JOB_REPOSITORY.marshallAsElement(model, writer);
BatchSubsystemDefinition.SECURITY_DOMAIN.marshallAsElement(model, writer);
BatchSubsystemDefinition.DEFAULT_THREAD_POOL.marshallAsElement(model, writer);
BatchSubsystemDefinition.RESTART_JOBS_ON_RESUME.marshallAsElement(model, writer);
BatchSubsystemDefinition.SECURITY_DOMAIN.marshallAsElement(model, writer);

// Write the in-memory job repositories
if (model.hasDefined(InMemoryJobRepositoryDefinition.NAME)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<extension-module>org.wildfly.extension.batch.jberet</extension-module>
<subsystem xmlns="urn:jboss:domain:batch-jberet:2.0">
<default-job-repository name="in-memory"/>
<?ELYTRON?>
<default-thread-pool name="batch"/>
<?ELYTRON?>
<job-repository name="in-memory">
<in-memory/>
</job-repository>
Expand All @@ -40,9 +40,4 @@
<keepalive-time time="30" unit="seconds"/>
</thread-pool>
</subsystem>
<supplement name="elytron">
<replacement placeholder="ELYTRON">
<security-domain name="ApplicationDomain"/>
</replacement>
</supplement>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

<subsystem xmlns="urn:jboss:domain:batch-jberet:2.0">
<default-job-repository name="in-memory"/>
<security-domain name="ApplicationDomain"/>
<default-thread-pool name="batch"/>
<restart-jobs-on-resume value="false"/>
<security-domain name="ApplicationDomain"/>
<job-repository name="in-memory">
<in-memory/>
</job-repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import org.jboss.jca.core.spi.transaction.TransactionIntegration;
import org.jboss.msc.service.ServiceTarget;

import static org.jboss.as.connector.logging.ConnectorLogger.ROOT_LOGGER;

/**
* @author <a href="jesper.pedersen@jboss.org">Jesper Pedersen</a>
* @author <a href="stefano.maestri@redhat.com">Stefano Maestri</a>
Expand Down Expand Up @@ -62,11 +64,14 @@ protected void performBoottime(final OperationContext context, final ModelNode o
final ServiceTarget serviceTarget = context.getServiceTarget();

if (install) {
ROOT_LOGGER.debug("Enabling the Cache Connection Manager valve and interceptor...");
context.addStep(new AbstractDeploymentChainStep() {
protected void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(JcaExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_CACHED_CONNECTION_MANAGER, new CachedConnectionManagerSetupProcessor());
}
}, OperationContext.Stage.RUNTIME);
} else {
ROOT_LOGGER.debug("Disabling the Cache Connection Manager valve and interceptor...");
}

CachedConnectionManagerService ccmService = new CachedConnectionManagerService(debug, error, ignoreUnknownConnections);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package org.jboss.as.connector.subsystems.jca;

import static org.jboss.as.connector.subsystems.jca.JcaCachedConnectionManagerDefinition.CcmParameters.DEBUG;
import static org.jboss.as.connector.subsystems.jca.JcaCachedConnectionManagerDefinition.CcmParameters.ERROR;
import static org.jboss.as.connector.subsystems.jca.JcaCachedConnectionManagerDefinition.CcmParameters.IGNORE_UNKNOWN_CONNECTIONS;
import static org.jboss.as.connector.subsystems.jca.JcaCachedConnectionManagerDefinition.CcmParameters.INSTALL;

import java.util.Set;

import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.OperationContext;
import org.jboss.as.controller.OperationFailedException;
import org.jboss.as.controller.OperationStepHandler;
import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.capability.RuntimeCapability;
import org.jboss.dmr.ModelNode;

class CachedConnectionManagerRemove implements OperationStepHandler {

static final CachedConnectionManagerRemove INSTANCE = new CachedConnectionManagerRemove();

private CachedConnectionManagerRemove() {}

@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {

// This is an odd case where we do not actually do a remove; we just reset state to
// what it would be following parsing if the xml element does not exist.
// See discussion on PR with fix for WFLY-2640 .
ModelNode model = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS).getModel();

for (JcaCachedConnectionManagerDefinition.CcmParameters param : JcaCachedConnectionManagerDefinition.CcmParameters.values()) {
AttributeDefinition ad = param.getAttribute();
if (param == INSTALL) {
model.get(ad.getName()).set(false);
} else if (param == DEBUG || param == ERROR || param == IGNORE_UNKNOWN_CONNECTIONS) {
model.get(ad.getName()).clear();
} else {
// Someone added a new param since WFLY-2640 and did not account for it above
throw new IllegalStateException();
}
}

// At the time of WFLY-2640 there were no capabilities associated with this resource,
// but if anyone adds one, part of the task is to deal with deregistration.
// So here's an assert to ensure that is considered
Set<RuntimeCapability> capabilitySet = context.getResourceRegistration().getCapabilities();
assert capabilitySet.isEmpty();

if (context.isDefaultRequiresRuntime()) {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext operationContext, ModelNode modelNode) throws OperationFailedException {
context.reloadRequired();
context.completeStep(new OperationContext.RollbackHandler() {
@Override
public void handleRollback(OperationContext operationContext, ModelNode modelNode) {
context.revertReloadRequired();
}
});
}
}, OperationContext.Stage.RUNTIME);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@

import org.jboss.as.controller.AttributeDefinition;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
import org.jboss.as.controller.ReloadRequiredWriteAttributeHandler;
import org.jboss.as.controller.SimpleAttributeDefinition;
import org.jboss.as.controller.SimpleAttributeDefinitionBuilder;
import org.jboss.as.controller.SimpleOperationDefinition;
import org.jboss.as.controller.SimpleOperationDefinitionBuilder;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.client.helpers.MeasurementUnit;
import org.jboss.as.controller.descriptions.ModelDescriptionConstants;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.as.controller.transform.description.DiscardAttributeChecker;
import org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder;
Expand All @@ -46,12 +46,17 @@
public class JcaCachedConnectionManagerDefinition extends SimpleResourceDefinition {
protected static final PathElement PATH_CACHED_CONNECTION_MANAGER = PathElement.pathElement(CACHED_CONNECTION_MANAGER, CACHED_CONNECTION_MANAGER);
static final JcaCachedConnectionManagerDefinition INSTANCE = new JcaCachedConnectionManagerDefinition();
private static final SimpleOperationDefinition ADD_DEFINITION =
new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.ADD, JcaExtension.getResourceDescriptionResolver())
.setPrivateEntry()
.build();
private static final SimpleOperationDefinition REMOVE_DEFINITION =
new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, JcaExtension.getResourceDescriptionResolver(PATH_CACHED_CONNECTION_MANAGER.getKey()))
.build();

private JcaCachedConnectionManagerDefinition() {
super(PATH_CACHED_CONNECTION_MANAGER,
JcaExtension.getResourceDescriptionResolver(PATH_CACHED_CONNECTION_MANAGER.getKey()),
CachedConnectionManagerAdd.INSTANCE,
ReloadRequiredRemoveStepHandler.INSTANCE);
JcaExtension.getResourceDescriptionResolver(PATH_CACHED_CONNECTION_MANAGER.getKey()));
}

@Override
Expand All @@ -72,6 +77,8 @@ public void registerAttributes(ManagementResourceRegistration resourceRegistrati
@Override
public void registerOperations(ManagementResourceRegistration resourceRegistration) {
super.registerOperations(resourceRegistration);
resourceRegistration.registerOperationHandler(ADD_DEFINITION, CachedConnectionManagerAdd.INSTANCE);
resourceRegistration.registerOperationHandler(REMOVE_DEFINITION, CachedConnectionManagerRemove.INSTANCE);
resourceRegistration.registerOperationHandler(CcmOperations.GET_NUMBER_OF_CONNECTIONS.getOperation(), GetNumberOfConnectionsHandler.INSTANCE);
resourceRegistration.registerOperationHandler(CcmOperations.LIST_CONNECTIONS.getOperation(), ListOfConnectionsHandler.INSTANCE);

Expand Down
Loading

0 comments on commit ca81bac

Please sign in to comment.