コード例 #1
0
 protected void describe(
     final Resource resource,
     final ModelNode address,
     ModelNode result,
     final ImmutableManagementResourceRegistration registration) {
   if (registration.isRemote()
       || registration.isRuntimeOnly()
       || resource.isProxy()
       || resource.isRuntime()) {
     return;
   }
   final Set<PathElement> children = registration.getChildAddresses(PathAddress.EMPTY_ADDRESS);
   result.add(createAddOperation(address, resource.getModel(), children));
   for (final PathElement element : children) {
     if (element.isMultiTarget()) {
       final String childType = element.getKey();
       for (final Resource.ResourceEntry entry : resource.getChildren(childType)) {
         final ImmutableManagementResourceRegistration childRegistration =
             registration.getSubModel(
                 PathAddress.pathAddress(PathElement.pathElement(childType, entry.getName())));
         final ModelNode childAddress = address.clone();
         childAddress.add(childType, entry.getName());
         describe(entry, childAddress, result, childRegistration);
       }
     } else {
       final Resource child = resource.getChild(element);
       final ImmutableManagementResourceRegistration childRegistration =
           registration.getSubModel(PathAddress.pathAddress(element));
       final ModelNode childAddress = address.clone();
       childAddress.add(element.getKey(), element.getValue());
       describe(child, childAddress, result, childRegistration);
     }
   }
 }
コード例 #2
0
 static String findPoolName(OperationContext context, String jndiName)
     throws OperationFailedException {
   PathAddress address = context.getCurrentAddress();
   PathAddress rootAddress = address.subAddress(0, address.size() - 4);
   PathAddress subsystemAddress =
       rootAddress.append(
           PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, "datasources"));
   Resource subsystem = context.readResourceFromRoot(subsystemAddress);
   for (String type : Arrays.asList("data-source", "xa-data-source")) {
     if (subsystem.hasChildren(type)) {
       for (Resource.ResourceEntry entry : subsystem.getChildren(type)) {
         ModelNode model = entry.getModel();
         if (model.get("jndi-name").asString().equals(jndiName)) {
           return entry.getName();
         }
       }
     }
   }
   throw InfinispanLogger.ROOT_LOGGER.dataSourceJndiNameNotFound(jndiName);
 }
コード例 #3
0
  @Override
  protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model)
      throws OperationFailedException {

    checkIfNodeIdentifierIsDefault(context, model);

    boolean jts = model.hasDefined(JTS) && model.get(JTS).asBoolean();

    final Resource subsystemResource =
        context.readResourceFromRoot(PathAddress.pathAddress(TransactionExtension.SUBSYSTEM_PATH));
    final List<ServiceName> deps = new LinkedList<>();

    for (Resource.ResourceEntry re : subsystemResource.getChildren(CM_RESOURCE)) {
      deps.add(TxnServices.JBOSS_TXN_CMR.append(re.getName()));
    }

    // recovery environment
    performRecoveryEnvBoottime(context, model, jts, deps);

    // core environment
    performCoreEnvironmentBootTime(context, model);

    // coordinator environment
    performCoordinatorEnvBoottime(context, model, jts);

    // object store
    performObjectStoreBoottime(context, model);

    // always propagate the transaction context
    // TODO: need a better way to do this, but this value gets cached in a static
    // so we need to make sure we set it before anything tries to read it
    jtsPropertyManager.getJTSEnvironmentBean().setAlwaysPropagateContext(true);

    context.addStep(
        new AbstractDeploymentChainStep() {
          protected void execute(final DeploymentProcessorTarget processorTarget) {
            processorTarget.addDeploymentProcessor(
                TransactionExtension.SUBSYSTEM_NAME,
                Phase.PARSE,
                Phase.PARSE_TRANSACTION_ROLLBACK_ACTION,
                new TransactionLeakRollbackProcessor());
            processorTarget.addDeploymentProcessor(
                TransactionExtension.SUBSYSTEM_NAME,
                Phase.POST_MODULE,
                Phase.POST_MODULE_TRANSACTIONS_EE_CONCURRENCY,
                new EEConcurrencyContextHandleFactoryProcessor());
            processorTarget.addDeploymentProcessor(
                TransactionExtension.SUBSYSTEM_NAME,
                Phase.INSTALL,
                Phase.INSTALL_TRANSACTION_BINDINGS,
                new TransactionJndiBindingProcessor());
            processorTarget.addDeploymentProcessor(
                TransactionExtension.SUBSYSTEM_NAME,
                Phase.DEPENDENCIES,
                Phase.DEPENDENCIES_TRANSACTIONS,
                new TransactionDependenciesProcessor());
            processorTarget.addDeploymentProcessor(
                TransactionExtension.SUBSYSTEM_NAME,
                Phase.DEPENDENCIES,
                Phase.DEPENDENCIES_TRANSACTIONS,
                new CompensationsDependenciesDeploymentProcessor());
          }
        },
        OperationContext.Stage.RUNTIME);

    // bind the TransactionManger and the TSR into JNDI
    final BinderService tmBinderService = new BinderService("TransactionManager");
    final ServiceBuilder<ManagedReferenceFactory> tmBuilder =
        context
            .getServiceTarget()
            .addService(
                ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("TransactionManager"),
                tmBinderService);
    tmBuilder.addDependency(
        ContextNames.JBOSS_CONTEXT_SERVICE_NAME,
        ServiceBasedNamingStore.class,
        tmBinderService.getNamingStoreInjector());
    tmBuilder.addDependency(
        TransactionManagerService.SERVICE_NAME,
        javax.transaction.TransactionManager.class,
        new Injector<javax.transaction.TransactionManager>() {
          @Override
          public void inject(final javax.transaction.TransactionManager value)
              throws InjectionException {
            tmBinderService
                .getManagedObjectInjector()
                .inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
          }

          @Override
          public void uninject() {
            tmBinderService.getManagedObjectInjector().uninject();
          }
        });
    tmBuilder.install();

    final BinderService tmLegacyBinderService = new BinderService("TransactionManager");
    final ServiceBuilder<ManagedReferenceFactory> tmLegacyBuilder =
        context
            .getServiceTarget()
            .addService(
                ContextNames.JAVA_CONTEXT_SERVICE_NAME.append("TransactionManager"),
                tmLegacyBinderService);
    tmLegacyBuilder.addDependency(
        ContextNames.JAVA_CONTEXT_SERVICE_NAME,
        ServiceBasedNamingStore.class,
        tmLegacyBinderService.getNamingStoreInjector());
    tmLegacyBuilder.addDependency(
        TransactionManagerService.SERVICE_NAME,
        javax.transaction.TransactionManager.class,
        new Injector<javax.transaction.TransactionManager>() {
          @Override
          public void inject(final javax.transaction.TransactionManager value)
              throws InjectionException {
            tmLegacyBinderService
                .getManagedObjectInjector()
                .inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
          }

          @Override
          public void uninject() {
            tmLegacyBinderService.getManagedObjectInjector().uninject();
          }
        });
    tmLegacyBuilder.install();

    final BinderService tsrBinderService = new BinderService("TransactionSynchronizationRegistry");
    final ServiceBuilder<ManagedReferenceFactory> tsrBuilder =
        context
            .getServiceTarget()
            .addService(
                ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append(
                    "TransactionSynchronizationRegistry"),
                tsrBinderService);
    tsrBuilder.addDependency(
        ContextNames.JBOSS_CONTEXT_SERVICE_NAME,
        ServiceBasedNamingStore.class,
        tsrBinderService.getNamingStoreInjector());
    tsrBuilder.addDependency(
        TransactionSynchronizationRegistryService.SERVICE_NAME,
        TransactionSynchronizationRegistry.class,
        new Injector<TransactionSynchronizationRegistry>() {
          @Override
          public void inject(final TransactionSynchronizationRegistry value)
              throws InjectionException {
            tsrBinderService
                .getManagedObjectInjector()
                .inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value)));
          }

          @Override
          public void uninject() {
            tsrBinderService.getManagedObjectInjector().uninject();
          }
        });
    tsrBuilder.install();

    // Install the UserTransactionAccessControlService
    final UserTransactionAccessControlService lookupControlService =
        new UserTransactionAccessControlService();
    context
        .getServiceTarget()
        .addService(UserTransactionAccessControlService.SERVICE_NAME, lookupControlService)
        .install();

    // Bind the UserTransaction into JNDI
    final UserTransactionBindingService userTransactionBindingService =
        new UserTransactionBindingService("UserTransaction");
    final ServiceBuilder<ManagedReferenceFactory> utBuilder =
        context
            .getServiceTarget()
            .addService(
                ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append("UserTransaction"),
                userTransactionBindingService);
    utBuilder
        .addDependency(
            ContextNames.JBOSS_CONTEXT_SERVICE_NAME,
            ServiceBasedNamingStore.class,
            userTransactionBindingService.getNamingStoreInjector())
        .addDependency(
            UserTransactionAccessControlService.SERVICE_NAME,
            UserTransactionAccessControlService.class,
            userTransactionBindingService.getUserTransactionAccessControlServiceInjector())
        .addDependency(
            UserTransactionService.SERVICE_NAME,
            UserTransaction.class,
            new ManagedReferenceInjector<UserTransaction>(
                userTransactionBindingService.getManagedObjectInjector()));
    utBuilder.install();

    // install the EE Concurrency transaction setup provider's service
    final TransactionSetupProviderService transactionSetupProviderService =
        new TransactionSetupProviderService();
    context
        .getServiceTarget()
        .addService(
            ConcurrentServiceNames.TRANSACTION_SETUP_PROVIDER_SERVICE_NAME,
            transactionSetupProviderService)
        .addDependency(
            TransactionManagerService.SERVICE_NAME,
            TransactionManager.class,
            transactionSetupProviderService.getTransactionManagerInjectedValue())
        .install();
  }