Ejemplo n.º 1
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);
      }
    }
  }
Ejemplo n.º 2
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);
  }