Exemple #1
0
  void removeRuntimeServices(OperationContext context, ModelNode operation, ModelNode model)
      throws OperationFailedException {
    // get container and cache addresses
    final PathAddress cacheAddress = getCacheAddressFromOperation(operation);
    final PathAddress containerAddress = getCacheContainerAddressFromOperation(operation);
    // get container and cache names
    final String cacheName = cacheAddress.getLastElement().getValue();
    final String containerName = containerAddress.getLastElement().getValue();

    // remove all services started by CacheAdd, in reverse order
    // remove the binder service
    ModelNode resolvedValue = null;
    final String jndiNameString =
        (resolvedValue = CommonAttributes.JNDI_NAME.resolveModelAttribute(context, model))
                .isDefined()
            ? resolvedValue.asString()
            : null;
    final String jndiName =
        InfinispanJndiName.createCacheJndiNameOrDefault(jndiNameString, containerName, cacheName);
    ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(jndiName);
    context.removeService(bindInfo.getBinderServiceName());
    // remove the CacheService instance
    context.removeService(CacheService.getServiceName(containerName, cacheName));
    // remove the cache configuration service
    context.removeService(CacheConfigurationService.getServiceName(containerName, cacheName));

    log.debugf("cache %s removed for container %s", cacheName, containerName);
  }
Exemple #2
0
  void removeRuntimeServices(
      OperationContext context, ModelNode operation, ModelNode containerModel, ModelNode cacheModel)
      throws OperationFailedException {
    // get container and cache addresses
    final PathAddress cacheAddress = getCacheAddressFromOperation(operation);
    final PathAddress containerAddress = getCacheContainerAddressFromOperation(operation);

    // get container and cache names
    final String cacheName = cacheAddress.getLastElement().getValue();
    final String containerName = containerAddress.getLastElement().getValue();

    // remove all services started by CacheAdd, in reverse order
    // remove the binder service
    ModelNode resolvedValue = null;
    final String jndiName =
        (resolvedValue =
                    CacheResourceDefinition.JNDI_NAME.resolveModelAttribute(context, cacheModel))
                .isDefined()
            ? resolvedValue.asString()
            : null;

    String defaultCacheName =
        CacheContainerResourceDefinition.DEFAULT_CACHE
            .resolveModelAttribute(context, containerModel)
            .asString();
    boolean defaultCache = cacheName.equals(defaultCacheName);

    ContextNames.BindInfo binding =
        createCacheBinding(
            (jndiName != null)
                ? JndiNameFactory.parse(jndiName)
                : createJndiName(containerName, cacheName));
    context.removeService(binding.getBinderServiceName());
    // remove the CacheService instance
    context.removeService(CacheService.getServiceName(containerName, cacheName));
    // remove the cache configuration service
    context.removeService(CacheConfigurationService.getServiceName(containerName, cacheName));

    for (CacheServiceProvider provider :
        ServiceLoader.load(
            CacheServiceProvider.class, CacheServiceProvider.class.getClassLoader())) {
      for (ServiceName name : provider.getServiceNames(containerName, cacheName, defaultCache)) {
        context.removeService(name);
      }
    }

    log.debugf("cache %s removed for container %s", cacheName, containerName);
  }
  void updatePoolService(final OperationContext context, final ModelNode model)
      throws OperationFailedException {

    final ModelNode poolName = poolAttribute.resolveModelAttribute(context, model);

    final ServiceRegistry serviceRegistry = context.getServiceRegistry(true);
    ServiceController existingDefaultPoolConfigService =
        serviceRegistry.getService(poolConfigServiceName);
    // if a default MDB pool is already installed, then remove it first
    if (existingDefaultPoolConfigService != null) {
      context.removeService(existingDefaultPoolConfigService);
    }

    if (poolName.isDefined()) {
      // now install default pool config service which points to an existing pool config service
      final ValueInjectionService<PoolConfig> newDefaultPoolConfigService =
          new ValueInjectionService<PoolConfig>();
      ServiceController<?> newController =
          context
              .getServiceTarget()
              .addService(poolConfigServiceName, newDefaultPoolConfigService)
              .addDependency(
                  PoolConfigService.EJB_POOL_CONFIG_BASE_SERVICE_NAME.append(poolName.asString()),
                  PoolConfig.class,
                  newDefaultPoolConfigService.getInjector())
              .install();
    }
  }
 void removeRuntimeService(OperationContext context, ModelNode operation) {
   final String name =
       PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS))
           .getLastElement()
           .getValue();
   final ServiceName serviceName = ContextNames.bindInfoFor(name).getBinderServiceName();
   context.removeService(serviceName);
 }
 @Override
 protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
     throws OperationFailedException {
   String spAlias =
       PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS))
           .getLastElement()
           .getValue();
   context.removeService(ServiceProviderService.createServiceName(spAlias));
 }
 private boolean isRemoveService(OperationContext context) {
   if (context.isNormalServer()) {
     if (context.isResourceServiceRestartAllowed()) {
       context.removeService(MBeanServerService.SERVICE_NAME);
       return true;
     }
   }
   return false;
 }
 protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) {
   if (isRemoveService(context)) {
     // Since so many things can depend on this, only remove if the user set the
     // ALLOW_RESOURCE_SERVICE_RESTART operation header
     context.removeService(MBeanServerService.SERVICE_NAME);
   } else {
     context.reloadRequired();
   }
 }
  @Override
  protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
      throws OperationFailedException {

    final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
    final String name = address.getLastElement().getValue();

    context.removeService(WSServices.CLIENT_CONFIG_SERVICE.append(name));
    context.reloadRequired();
  }
 @Override
 protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
     throws OperationFailedException {
   final String name =
       PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS))
           .getLastElement()
           .getValue();
   final ServiceName serviceName =
       AbstractOutboundConnectionService.OUTBOUND_CONNECTION_BASE_SERVICE_NAME.append(name);
   context.removeService(serviceName);
 }
  void removeRuntimeServices(OperationContext context, ModelNode operation, ModelNode model)
      throws OperationFailedException {

    final PathAddress address = getCacheContainerAddressFromOperation(operation);
    final String containerName = address.getLastElement().getValue();

    // need to remove all container-related services started, in reverse order
    context.removeService(KeyAffinityServiceFactoryService.getServiceName(containerName));

    // remove the BinderService entry
    ModelNode resolvedValue = null;
    final String jndiName =
        (resolvedValue =
                    CacheContainerResourceDefinition.JNDI_NAME.resolveModelAttribute(
                        context, model))
                .isDefined()
            ? resolvedValue.asString()
            : null;
    context.removeService(
        createCacheContainerBinding(jndiName, containerName).getBinderServiceName());

    // remove the cache container
    context.removeService(EmbeddedCacheManagerService.getServiceName(containerName));
    context.removeService(EmbeddedCacheManagerConfigurationService.getServiceName(containerName));
    context.removeService(GlobalComponentRegistryService.getServiceName(containerName));

    // check if a channel was installed
    final ServiceName channelServiceName = ChannelService.getServiceName(containerName);
    final ServiceController<?> channelServiceController =
        context.getServiceRegistry(false).getService(channelServiceName);
    if (channelServiceController != null) {
      for (ChannelServiceProvider provider :
          ServiceLoader.load(
              ChannelServiceProvider.class, ChannelServiceProvider.class.getClassLoader())) {
        for (ServiceName name : provider.getServiceNames(containerName)) {
          context.removeService(name);
        }
      }
      // unregister the protocol metrics by adding a step
      ChannelInstanceResourceDefinition.addChannelProtocolMetricsDeregistrationStep(
          context, containerName);

      context.removeService(createChannelBinding(containerName).getBinderServiceName());
      context.removeService(channelServiceName);
    }
  }
 /** {@inheritDoc} */
 @Override
 public void removeServices(OperationContext context, ModelNode model) {
   context.removeService(new DeploymentPolicyServiceNameProvider().getServiceName());
 }
 @Override
 protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
     throws OperationFailedException {
   // Remove any services installed by the corresponding add handler here
   context.removeService(RhqMetricsService.SERVICE_NAME);
 }
 @Override
 protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model)
     throws OperationFailedException {
   context.removeService(EndpointUtils.getServiceName(operation, "memcached"));
 }
 protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) {
   final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
   final String name = address.getLastElement().getValue();
   context.removeService(SipSubsystemServices.JBOSS_SIP_CONNECTOR.append(name));
 }
 @Override
 public void removeServices(OperationContext context, ModelNode model)
     throws OperationFailedException {
   context.removeService(
       this.builderFactory.createBuilder(context.getCurrentAddress()).getServiceName());
 }