org.jboss.as.controller.operations.common.Util.getNameFromAddress()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.jboss.as.controller.operations.common.Util.getNameFromAddress()方法的一些代码示例,展示了Util.getNameFromAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getNameFromAddress()方法的具体详情如下:
包路径:org.jboss.as.controller.operations.common.Util
类名称:Util
方法名:getNameFromAddress

Util.getNameFromAddress介绍

暂无

代码示例

代码示例来源:origin: org.keycloak/keycloak-as7-server-subsystem

static String getDeploymentName(ModelNode operation) {
    String deploymentName = Util.getNameFromAddress(operation.get(ADDRESS));
    if (!deploymentName.toLowerCase().endsWith(".war")) {
      deploymentName += ".war";
    }

    return deploymentName;
  }
}

代码示例来源:origin: org.keycloak/keycloak-eap6-server-subsystem

static String getDeploymentName(ModelNode operation) {
    String deploymentName = Util.getNameFromAddress(operation.get(ADDRESS));
    if (!deploymentName.toLowerCase().endsWith(".war")) {
      deploymentName += ".war";
    }

    return deploymentName;
  }
}

代码示例来源:origin: org.keycloak/keycloak-wf9-server-subsystem

static String getDeploymentName(ModelNode operation) {
    String deploymentName = Util.getNameFromAddress(operation.get(ADDRESS));
    if (!deploymentName.toLowerCase().endsWith(".war")) {
      deploymentName += ".war";
    }

    return deploymentName;
  }
}

代码示例来源:origin: wildfly/wildfly-core

@Override
  protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {
    auditLogger.recycleHandler(Util.getNameFromAddress(operation.require(OP_ADDR)));
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

@Override
  protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<Void> handbackHolder) throws OperationFailedException {
    if (MAX_HISTORY.equals(attributeName)) {
      final String name = Util.getNameFromAddress(operation.require(OP_ADDR));
      auditLogger.updateInMemoryHandlerMaxHistory(name, resolvedValue.asInt());
    }
    return false;
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

@Override
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, Void handback) throws OperationFailedException {
  if (MAX_HISTORY.equals(attributeName)) {
    final String name = Util.getNameFromAddress(operation.require(OP_ADDR));
    auditLogger.updateInMemoryHandlerMaxHistory(name, valueToRevert.asInt());
  }
}

代码示例来源:origin: wildfly/wildfly-core

@Override
  protected boolean applyUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode resolvedValue, ModelNode currentValue, HandbackHolder<Void> handbackHolder) throws OperationFailedException {
    if (MAX_HISTORY.equals(attributeName)) {
      final String name = Util.getNameFromAddress(operation.require(OP_ADDR));
      auditLogger.updateInMemoryHandlerMaxHistory(name, resolvedValue.asInt());
    }
    return false;
  }
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

static SyslogAuditLogHandler createHandler(final PathManagerService pathManager,
                      final OperationContext context,
                      final EnvironmentNameReader environmentReader) throws OperationFailedException {
  final PathAddress pathAddress = getAffectedHandlerAddress(context);
  final String name = Util.getNameFromAddress(pathAddress);
  final Resource handlerResource = context.readResourceFromRoot(pathAddress);
  return createHandler(pathManager, context, name, handlerResource, environmentReader);
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

@Override
  protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException {
    String attr = operation.require(ModelDescriptionConstants.NAME).asString();
    String handlerName = Util.getNameFromAddress(operation.require(OP_ADDR));
    if (attr.equals(FAILURE_COUNT.getName())) {
      context.getResult().set(auditLogger.getHandlerFailureCount(handlerName));
    } else if (attr.equals(DISABLED_DUE_TO_FAILURE.getName())) {
      context.getResult().set(auditLogger.getHandlerDisabledDueToFailure(handlerName));
    }
  }
}

代码示例来源:origin: wildfly/wildfly-core

static SyslogAuditLogHandler createHandler(final PathManagerService pathManager,
                      final OperationContext context,
                      final EnvironmentNameReader environmentReader) throws OperationFailedException {
  final PathAddress pathAddress = getAffectedHandlerAddress(context);
  final String name = Util.getNameFromAddress(pathAddress);
  final Resource handlerResource = context.readResourceFromRoot(pathAddress);
  return createHandler(pathManager, context, name, handlerResource, environmentReader);
}

代码示例来源:origin: wildfly/wildfly-core

@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
  String name = Util.getNameFromAddress(operation.require(OP_ADDR));
  auditLogger.getUpdater().removeHandler(name);
  context.removeService(SYSLOG_AUDIT_HANDLER.append(name));
}

代码示例来源:origin: wildfly/wildfly-core

protected InMemoryAuditLogHander createHandler(final OperationContext context, final ModelNode operation) throws OperationFailedException {
  final String name = Util.getNameFromAddress(operation.require(OP_ADDR));
  final int maxHistory = MAX_OPERATION_COUNT.resolveModelAttribute(context, operation).asInt();
  return new InMemoryAuditLogHander(name, maxHistory);
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
  PathAddress handlerAddress = SyslogAuditLogHandlerResourceDefinition.getAffectedHandlerAddress(context);
  try {
    Resource handleResource = context.readResourceFromRoot(handlerAddress);
    String name = Util.getNameFromAddress(handlerAddress);
    auditLogger.getUpdater().updateHandler(SyslogAuditLogHandlerResourceDefinition.createHandler(pathManager, context, name, handleResource, environmentReader));
  } catch (Resource.NoSuchResourceException ignored) {
    // WFCORE-810 handler resource has been removed in this same op, so we do nothing
  }
}

代码示例来源:origin: wildfly/wildfly-core

@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
  PathAddress handlerAddress = SyslogAuditLogHandlerResourceDefinition.getAffectedHandlerAddress(context);
  try {
    Resource handleResource = context.readResourceFromRoot(handlerAddress);
    String name = Util.getNameFromAddress(handlerAddress);
    auditLogger.getUpdater().updateHandler(SyslogAuditLogHandlerResourceDefinition.createHandler(pathManager, context, name, handleResource, environmentReader));
  } catch (Resource.NoSuchResourceException ignored) {
    // WFCORE-810 handler resource has been removed in this same op, so we do nothing
  }
}

代码示例来源:origin: wildfly/wildfly-core

@Override
protected ServiceController<?> getService(final OperationContext context, final ModelNode model) throws OperationFailedException {
  final String name = Util.getNameFromAddress(model.require(OP_ADDR));
  final ServiceName serviceName = ThreadsServices.threadFactoryName(name);
  ServiceController<?> controller = context.getServiceRegistry(true).getService(serviceName);
  if(controller == null) {
    throw ThreadsLogger.ROOT_LOGGER.threadFactoryServiceNotFound(serviceName);
  }
  return controller;
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

@Override
protected void performRemove(OperationContext context, ModelNode operation, ModelNode model)
    throws OperationFailedException {
  final String name = Util.getNameFromAddress(operation.require(OP_ADDR));
  final Resource auditLog = context.readResourceFromRoot(PathAddress.pathAddress(CoreManagementResourceDefinition.PATH_ELEMENT, AccessAuditResourceDefinition.PATH_ELEMENT));
  checkFormatterNotReferenced(name, auditLog, HANDLER_TYPES);
  super.performRemove(context, operation, model);
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

private static FileAuditLogHandler createFileAuditLogHandler(final PathManagerService pathManager,
                               final OperationContext context, final ModelNode operation) throws OperationFailedException {
  final String name = Util.getNameFromAddress(operation.require(ModelDescriptionConstants.OP_ADDR));
  final ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
  final String relativeTo = model.hasDefined(RELATIVE_TO.getName()) ? RELATIVE_TO.resolveModelAttribute(context, model).asString() : null;
  final String path = PATH.resolveModelAttribute(context, model).asString();
  final String formatterName = FORMATTER.resolveModelAttribute(context, model).asString();
  final int maxFailureCount = MAX_FAILURE_COUNT.resolveModelAttribute(context, model).asInt();
  final boolean rotateAtStartup = ROTATE_AT_STARTUP.resolveModelAttribute(context, model).asBoolean();
  return new FileAuditLogHandler(name, formatterName, maxFailureCount, pathManager, path, relativeTo, rotateAtStartup);
}

代码示例来源:origin: wildfly/wildfly-core

private static JsonAuditLogItemFormatter createFormatter(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
  return new JsonAuditLogItemFormatter(
      Util.getNameFromAddress(operation.require(OP_ADDR)),
      INCLUDE_DATE.resolveModelAttribute(context, model).asBoolean(),
      DATE_SEPARATOR.resolveModelAttribute(context, model).asString(),
      DATE_FORMAT.resolveModelAttribute(context, model).asString(),
      COMPACT.resolveModelAttribute(context, model).asBoolean(),
      ESCAPE_NEW_LINE.resolveModelAttribute(context, model).asBoolean(),
      ESCAPE_CONTROL_CHARACTERS.resolveModelAttribute(context, model).asBoolean());
}

代码示例来源:origin: org.wildfly.core/wildfly-domain-management

private static JsonAuditLogItemFormatter createFormatter(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
  return new JsonAuditLogItemFormatter(
      Util.getNameFromAddress(operation.require(OP_ADDR)),
      INCLUDE_DATE.resolveModelAttribute(context, model).asBoolean(),
      DATE_SEPARATOR.resolveModelAttribute(context, model).asString(),
      DATE_FORMAT.resolveModelAttribute(context, model).asString(),
      COMPACT.resolveModelAttribute(context, model).asBoolean(),
      ESCAPE_NEW_LINE.resolveModelAttribute(context, model).asBoolean(),
      ESCAPE_CONTROL_CHARACTERS.resolveModelAttribute(context, model).asBoolean());
}

代码示例来源:origin: wildfly/wildfly-core

private static SizeRotatingFileAuditLogHandler createSizeRotatingFileAuditLogHandler(final PathManagerService pathManager,
                      final OperationContext context, final ModelNode operation) throws OperationFailedException {
  final String name = Util.getNameFromAddress(operation.require(OP_ADDR));
  final ModelNode model = context.readResource(PathAddress.EMPTY_ADDRESS).getModel();
  final String relativeTo = model.hasDefined(RELATIVE_TO.getName()) ? RELATIVE_TO.resolveModelAttribute(context, model).asString() : null;
  final String path = PATH.resolveModelAttribute(context, model).asString();
  final String formatterName = FORMATTER.resolveModelAttribute(context, model).asString();
  final int maxFailureCount = MAX_FAILURE_COUNT.resolveModelAttribute(context, model).asInt();
  final long rotateSize = SizeValidator.parseSize(ROTATE_SIZE.resolveModelAttribute(context, model));
  final int maxBackupIndex = MAX_BACKUP_INDEX.resolveModelAttribute(context, model).asInt();
  return new SizeRotatingFileAuditLogHandler(name, formatterName, maxFailureCount, pathManager, path, relativeTo, rotateSize, maxBackupIndex);
}

相关文章