Search in sources :

Example 1 with FileTimerPersistence

use of org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence in project wildfly by wildfly.

the class FileDataStoreAdd method performRuntime.

protected void performRuntime(final OperationContext context, ModelNode operation, final ModelNode model, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) throws OperationFailedException {
    final ModelNode pathNode = FileDataStoreResourceDefinition.PATH.resolveModelAttribute(context, model);
    final String path = pathNode.isDefined() ? pathNode.asString() : null;
    final ModelNode relativeToNode = FileDataStoreResourceDefinition.RELATIVE_TO.resolveModelAttribute(context, model);
    final String relativeTo = relativeToNode.isDefined() ? relativeToNode.asString() : null;
    final FileTimerPersistence fileTimerPersistence = new FileTimerPersistence(true, path, relativeTo);
    final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
    final ServiceName serviceName = TimerPersistence.SERVICE_NAME.append(address.getLastElement().getValue());
    newControllers.add(context.getServiceTarget().addService(serviceName, fileTimerPersistence).addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ModuleLoader.class, fileTimerPersistence.getModuleLoader()).addDependency(PathManagerService.SERVICE_NAME, PathManager.class, fileTimerPersistence.getPathManager()).addDependency(TransactionManagerService.SERVICE_NAME, TransactionManager.class, fileTimerPersistence.getTransactionManager()).addDependency(TransactionSynchronizationRegistryService.SERVICE_NAME, TransactionSynchronizationRegistry.class, fileTimerPersistence.getTransactionSynchronizationRegistry()).install());
}
Also used : ModuleLoader(org.jboss.modules.ModuleLoader) ServiceName(org.jboss.msc.service.ServiceName) TransactionManager(javax.transaction.TransactionManager) PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode) FileTimerPersistence(org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence)

Example 2 with FileTimerPersistence

use of org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence in project wildfly by wildfly.

the class FileDataStoreAdd method performRuntime.

protected void performRuntime(final OperationContext context, ModelNode operation, final ModelNode model) throws OperationFailedException {
    final ModelNode pathNode = FileDataStoreResourceDefinition.PATH.resolveModelAttribute(context, model);
    final String path = pathNode.isDefined() ? pathNode.asString() : null;
    final ModelNode relativeToNode = FileDataStoreResourceDefinition.RELATIVE_TO.resolveModelAttribute(context, model);
    final String relativeTo = relativeToNode.isDefined() ? relativeToNode.asString() : null;
    final FileTimerPersistence fileTimerPersistence = new FileTimerPersistence(true, path, relativeTo);
    // add the TimerPersistence instance
    final CapabilityServiceTarget serviceTarget = context.getCapabilityServiceTarget();
    final CapabilityServiceBuilder<FileTimerPersistence> builder = serviceTarget.addCapability(TimerServiceResourceDefinition.TIMER_PERSISTENCE_CAPABILITY, fileTimerPersistence);
    builder.addDependency(Services.JBOSS_SERVICE_MODULE_LOADER, ModuleLoader.class, fileTimerPersistence.getModuleLoader());
    builder.addCapabilityRequirement(PATH_MANAGER_CAPABILITY_NAME, PathManager.class, fileTimerPersistence.getPathManager());
    builder.addCapabilityRequirement(TRANSACTION_GLOBAL_DEFAULT_LOCAL_PROVIDER_CAPABILITY_NAME, Void.class);
    builder.addCapabilityRequirement(TRANSACTION_SYNCHRONIZATION_REGISTRY_CAPABILITY_NAME, TransactionSynchronizationRegistry.class, fileTimerPersistence.getTransactionSynchronizationRegistry());
    builder.install();
}
Also used : ModelNode(org.jboss.dmr.ModelNode) FileTimerPersistence(org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence) CapabilityServiceTarget(org.jboss.as.controller.CapabilityServiceTarget)

Aggregations

FileTimerPersistence (org.jboss.as.ejb3.timerservice.persistence.filestore.FileTimerPersistence)2 ModelNode (org.jboss.dmr.ModelNode)2 TransactionManager (javax.transaction.TransactionManager)1 CapabilityServiceTarget (org.jboss.as.controller.CapabilityServiceTarget)1 PathAddress (org.jboss.as.controller.PathAddress)1 ModuleLoader (org.jboss.modules.ModuleLoader)1 ServiceName (org.jboss.msc.service.ServiceName)1