static void launchServices(
      OperationContext context,
      ModelNode operation,
      ModelNode model,
      ServiceVerificationHandler verificationHandler,
      List<ServiceController<?>> newControllers)
      throws OperationFailedException {
    PathAddress pathAddress =
        PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS));
    String federationAlias =
        pathAddress.subAddress(0, pathAddress.size() - 1).getLastElement().getValue();

    ModelNode relativeToNode =
        KeyStoreProviderResourceDefinition.RELATIVE_TO.resolveModelAttribute(context, model);
    String relativeTo = null;

    if (relativeToNode.isDefined()) {
      relativeTo = relativeToNode.asString();
    }

    String file =
        KeyStoreProviderResourceDefinition.FILE.resolveModelAttribute(context, model).asString();

    KeyStoreProviderService service =
        new KeyStoreProviderService(toKeyProviderType(context, model), file, relativeTo);
    ServiceBuilder<KeyStoreProviderService> serviceBuilder =
        context
            .getServiceTarget()
            .addService(KeyStoreProviderService.createServiceName(federationAlias), service);

    serviceBuilder.addDependency(
        FederationService.createServiceName(federationAlias),
        FederationService.class,
        service.getFederationService());

    serviceBuilder.addDependency(
        PathManagerService.SERVICE_NAME, PathManager.class, service.getPathManager());

    if (verificationHandler != null) {
      serviceBuilder.addListener(verificationHandler);
    }

    ServiceController<KeyStoreProviderService> controller =
        serviceBuilder.setInitialMode(ServiceController.Mode.PASSIVE).install();

    if (newControllers != null) {
      newControllers.add(controller);
    }
  }
Esempio n. 2
0
  void launchServices(
      ModelNode operation,
      OperationContext context,
      ServiceVerificationHandler verificationHandler,
      List<ServiceController<?>> newControllers) {
    PathAddress pathAddress =
        PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR));
    String alias = pathAddress.getLastElement().getValue();
    FederationService service = new FederationService(alias);
    ServiceBuilder<FederationService> serviceBuilder =
        context.getServiceTarget().addService(FederationService.createServiceName(alias), service);

    serviceBuilder.addDependency(UndertowService.UNDERTOW);

    ServiceController<FederationService> controller =
        serviceBuilder.addListener(verificationHandler).setInitialMode(Mode.ACTIVE).install();

    if (newControllers != null) {
      newControllers.add(controller);
    }
  }