@Override
 public void registerAttributes(ManagementResourceRegistration hostRegistration) {
   super.registerAttributes(hostRegistration);
   hostRegistration.registerReadWriteAttribute(
       DIRECTORY_GROUPING,
       null,
       new ReloadRequiredWriteAttributeHandler(DIRECTORY_GROUPING) {
         @Override
         protected boolean requiresRuntime(OperationContext context) {
           return context.getRunningMode() == RunningMode.NORMAL && !context.isBooting();
         }
       });
   hostRegistration.registerReadOnlyAttribute(PRODUCT_NAME, null);
   hostRegistration.registerReadOnlyAttribute(SERVER_STATE, null);
   hostRegistration.registerReadOnlyAttribute(RELEASE_VERSION, null);
   hostRegistration.registerReadOnlyAttribute(RELEASE_CODENAME, null);
   hostRegistration.registerReadOnlyAttribute(PRODUCT_VERSION, null);
   hostRegistration.registerReadOnlyAttribute(MANAGEMENT_MAJOR_VERSION, null);
   hostRegistration.registerReadOnlyAttribute(MANAGEMENT_MINOR_VERSION, null);
   hostRegistration.registerReadOnlyAttribute(MANAGEMENT_MICRO_VERSION, null);
   hostRegistration.registerReadOnlyAttribute(MASTER, IsMasterHandler.INSTANCE);
   hostRegistration.registerReadOnlyAttribute(DOMAIN_CONTROLLER, null);
   hostRegistration.registerReadOnlyAttribute(ServerRootResourceDefinition.NAMESPACES, null);
   hostRegistration.registerReadOnlyAttribute(ServerRootResourceDefinition.SCHEMA_LOCATIONS, null);
   hostRegistration.registerReadWriteAttribute(
       HostResourceDefinition.NAME,
       environment.getProcessNameReadHandler(),
       environment.getProcessNameWriteHandler());
   hostRegistration.registerReadOnlyAttribute(
       HostResourceDefinition.HOST_STATE, new ProcessStateAttributeHandler(processState));
   hostRegistration.registerReadOnlyAttribute(
       ServerRootResourceDefinition.RUNNING_MODE, new RunningModeReadHandler(runningModeControl));
   hostRegistration.registerReadOnlyAttribute(
       ServerRootResourceDefinition.SUSPEND_STATE, SuspendStateReadHandler.INSTANCE);
 }
示例#2
0
  /**
   * Update the model to hold domain level configuration.
   *
   * @param rootResource the root resource to be updated.
   * @param environment the host controller's configuration environment
   */
  public static void updateCoreModel(
      final Resource rootResource, HostControllerEnvironment environment) {
    final ModelNode rootModel = rootResource.getModel();
    rootModel.get(RELEASE_VERSION).set(Version.AS_VERSION);
    rootModel.get(RELEASE_CODENAME).set(Version.AS_RELEASE_CODENAME);
    rootModel.get(MANAGEMENT_MAJOR_VERSION).set(Version.MANAGEMENT_MAJOR_VERSION);
    rootModel.get(MANAGEMENT_MINOR_VERSION).set(Version.MANAGEMENT_MINOR_VERSION);

    // Community uses UNDEF values
    ModelNode nameNode = rootModel.get(PRODUCT_NAME);
    ModelNode versionNode = rootModel.get(PRODUCT_VERSION);

    if (environment != null) {
      String productName = environment.getProductConfig().getProductName();
      String productVersion = environment.getProductConfig().getProductVersion();

      if (productName != null) {
        nameNode.set(productName);
      }
      if (productVersion != null) {
        versionNode.set(productVersion);
      }
    }
  }
示例#3
0
  @Override
  public void registerAttributes(ManagementResourceRegistration resourceRegistration) {
    super.registerAttributes(resourceRegistration);
    resourceRegistration.registerReadWriteAttribute(
        NAME, null, new WriteAttributeHandlers.AttributeDefinitionValidatingHandler(NAME));

    resourceRegistration.registerReadOnlyAttribute(
        PROCESS_TYPE, isMaster ? ProcessTypeHandler.MASTER : ProcessTypeHandler.SLAVE);
    resourceRegistration.registerReadOnlyAttribute(
        LAUNCH_TYPE, new LaunchTypeHandler(ServerEnvironment.LaunchType.DOMAIN));
    resourceRegistration.registerReadOnlyAttribute(
        LOCAL_HOST_NAME, new LocalHostNameOperationHandler(hostControllerInfo));

    resourceRegistration.registerReadOnlyAttribute(
        MANAGEMENT_MAJOR_VERSION, ManagementVersionAttributeHandler.INSTANCE);
    resourceRegistration.registerReadOnlyAttribute(
        MANAGEMENT_MINOR_VERSION, ManagementVersionAttributeHandler.INSTANCE);
    resourceRegistration.registerReadOnlyAttribute(
        MANAGEMENT_MICRO_VERSION, ManagementVersionAttributeHandler.INSTANCE);

    resourceRegistration.registerReadOnlyAttribute(
        RELEASE_VERSION, ReleaseVersionAttributeHandler.INSTANCE);
    resourceRegistration.registerReadOnlyAttribute(
        RELEASE_CODENAME, ReleaseVersionAttributeHandler.INSTANCE);

    ProductInfoAttributeHandler infoHandler =
        new ProductInfoAttributeHandler(
            environment != null ? environment.getProductConfig() : null);
    resourceRegistration.registerReadOnlyAttribute(PRODUCT_NAME, infoHandler);
    resourceRegistration.registerReadOnlyAttribute(PRODUCT_VERSION, infoHandler);

    resourceRegistration.registerReadOnlyAttribute(
        NAMESPACES, DefaultEmptyListAttributeHandler.INSTANCE);
    resourceRegistration.registerReadOnlyAttribute(
        SCHEMA_LOCATIONS, DefaultEmptyListAttributeHandler.INSTANCE);
  }