/** * Suppresses removal of the log-store=log-store child, as that remove op handler is a no-op. */ @Override protected boolean removeChildRecursively(PathElement child) { return !TransactionExtension.LOG_STORE_PATH.equals(child); } }
if (operationAddress.getElement(0).equals(JGroupsSubsystemResourceDefinition.PATH)) { jgroupsOpsToMove.add(op); iterator.remove();
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder builder) { if (InfinispanModel.VERSION_6_0_0.requiresTransformation(version)) { Converter converter = (PathAddress address, String name, ModelNode value, ModelNode model, TransformationContext context) -> { PathAddress storeAddress = address.getParent(); PathElement storePath = storeAddress.getLastElement(); if (storePath.equals(StringKeyedJDBCStoreResourceDefinition.STRING_JDBC_PATH) || storePath.equals(StringKeyedJDBCStoreResourceDefinition.LEGACY_PATH)) { storeAddress = storeAddress.getParent().append(StringKeyedJDBCStoreResourceDefinition.PATH); } else if (storePath.equals(BinaryKeyedJDBCStoreResourceDefinition.LEGACY_PATH)) { storeAddress = storeAddress.getParent().append(BinaryKeyedJDBCStoreResourceDefinition.PATH); } else if (storePath.equals(MixedKeyedJDBCStoreResourceDefinition.LEGACY_PATH)) { storeAddress = storeAddress.getParent().append(MixedKeyedJDBCStoreResourceDefinition.PATH); } ModelNode store = context.readResourceFromRoot(storeAddress).getModel(); value.set(store.hasDefined(StoreResourceDefinition.Attribute.MAX_BATCH_SIZE.getName()) ? store.get(StoreResourceDefinition.Attribute.MAX_BATCH_SIZE.getName()) : StoreResourceDefinition.Attribute.MAX_BATCH_SIZE.getDefinition().getDefaultValue()); }; builder.getAttributeBuilder().setValueConverter(new SimpleAttributeConverter(converter), DeprecatedAttribute.BATCH_SIZE.getDefinition()); } }
@Override public PathAddress convertToTargetAddress(PathAddress aliasAddress, AliasContext aliasContext) { PathAddress rebuiltAddress = PathAddress.EMPTY_ADDRESS; for (PathElement pathElement : aliasAddress) { if (pathElement.equals(LEGACY_PATH)) { try { if (aliasContext.readResourceFromRoot(rebuiltAddress, false).hasChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey())) { Set<Resource.ResourceEntry> children = aliasContext.readResourceFromRoot(rebuiltAddress, false).getChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey()); if (children.size() > 1 && !Operations.getOperationName(aliasContext.getOperation()).equals(AliasContext.RECURSIVE_GLOBAL_OP)) { throw new IllegalStateException(ModClusterLogger.ROOT_LOGGER.legacyOperationsWithMultipleProxies()); } PathAddress proxyPath = PathAddress.pathAddress(ProxyConfigurationResourceDefinition.pathElement(children.iterator().next().getName())); rebuiltAddress = rebuiltAddress.append(proxyPath); } else { // handle :add rebuiltAddress = rebuiltAddress.append(ProxyConfigurationResourceDefinition.pathElement("default")); } } catch (Resource.NoSuchResourceException ignore) { // handle recursive-global-op rebuiltAddress = rebuiltAddress.append(ProxyConfigurationResourceDefinition.WILDCARD_PATH); } } else { rebuiltAddress = rebuiltAddress.append(pathElement); } } return rebuiltAddress; } });
/** * Determine whether this object is equal to another. * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(Object other) { return other instanceof PathElement && equals((PathElement) other); }
/** * Determine whether this object is equal to another. * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(Object other) { return other instanceof PathElement && equals((PathElement) other); }
/** * Determine whether this object is equal to another. * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(Object other) { return other instanceof PathElement && equals((PathElement) other); }
/** * Suppresses removal of the log-store=log-store child, as that remove op handler is a no-op. */ @Override protected boolean removeChildRecursively(PathElement child) { return !TransactionExtension.LOG_STORE_PATH.equals(child); } }
@Override public boolean equals(Object obj) { if (!(obj instanceof OSGiBundleResourceEntry)) return false; OSGiBundleResourceEntry other = (OSGiBundleResourceEntry) obj; return path.equals(other.path); }
@Override public boolean equals(Object obj) { if (!(obj instanceof OSGiBundleResourceEntry)) return false; OSGiBundleResourceEntry other = (OSGiBundleResourceEntry) obj; return path.equals(other.path); }
/** * Suppresses removal of the log-store=log-store child, as that remove op handler is a no-op. */ @Override protected boolean removeChildRecursively(PathElement child) { return !TransactionExtension.LOG_STORE_PATH.equals(child); } }
/** * Determine whether this object is equal to another. * @param other the other object * @return {@code true} if they are equal, {@code false} otherwise */ public boolean equals(Object other) { return other instanceof PathElement && equals((PathElement) other); }
private boolean isTopRole(PathAddress address) { if (address.size() >= 3) { PathElement roleMapping; if (MGMT_ELEMENT.equals(address.getElement(0)) && AUTHZ_ELEMENT.equals(address.getElement(1)) && ROLE_MAPPING.equals((roleMapping = address.getElement(2)).getKey())) { String roleName = roleMapping.getValue(); return StandardRole.AUDITOR.name().equalsIgnoreCase(roleName) || StandardRole.SUPERUSER.name().equalsIgnoreCase(roleName); } } return false; }
private boolean isTopRole(PathAddress address) { if (address.size() >= 3) { PathElement roleMapping; if (MGMT_ELEMENT.equals(address.getElement(0)) && AUTHZ_ELEMENT.equals(address.getElement(1)) && ROLE_MAPPING.equals((roleMapping = address.getElement(2)).getKey())) { String roleName = roleMapping.getValue(); return StandardRole.AUDITOR.name().equalsIgnoreCase(roleName) || StandardRole.SUPERUSER.name().equalsIgnoreCase(roleName); } } return false; }
@Override protected void describe(OrderedChildTypesAttachment orderedChildTypesAttachment, Resource resource, ModelNode address, ModelNode result, ImmutableManagementResourceRegistration registration) { // Don't describe the configuration=endpoint resource. It's just an alias for // a set of attributes on its parent and the parent description covers those. PathElement pe = registration.getPathAddress().getLastElement(); if (!pe.equals(RemotingEndpointResource.ENDPOINT_PATH)) { super.describe(orderedChildTypesAttachment, resource, address, result, registration); } } }
private boolean isTopRole(TargetResource target) { PathAddress address = target.getResourceAddress(); if (address.size() >= 3) { PathElement roleMapping; if (MGMT_ELEMENT.equals(address.getElement(0)) && AUTHZ_ELEMENT.equals(address.getElement(1)) && ROLE_MAPPING.equals((roleMapping = address.getElement(2)).getKey())) { String roleName = roleMapping.getValue(); return StandardRole.AUDITOR.name().equalsIgnoreCase(roleName) || StandardRole.SUPERUSER.name().equalsIgnoreCase(roleName); } } return false; }
private static Resource requireChild(final Resource resource, final PathElement childPath, final PathAddress fullAddress) { if (resource.hasChild(childPath)) { return resource.requireChild(childPath); } else { PathAddress missing = PathAddress.EMPTY_ADDRESS; for (PathElement search : fullAddress) { missing = missing.append(search); if (search.equals(childPath)) { break; } } throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(missing); } }
private static Resource requireChild(final Resource resource, final PathElement childPath, final PathAddress fullAddress) { if (resource.hasChild(childPath)) { return resource.requireChild(childPath); } else { PathAddress missing = PathAddress.EMPTY_ADDRESS; for (PathElement search : fullAddress) { missing = missing.append(search); if (search.equals(childPath)) { break; } } throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(missing); } }
@Override protected ServiceName getParentServiceName(PathAddress parentAddress) { int containerPosition = PathAddressUtils.indexOfKey(parentAddress, CacheContainerResource.CONTAINER_PATH.getKey()); String containerName = parentAddress.getElement(containerPosition).getValue(); int resourceOffset = containerPosition + 1; if (parentAddress.getElement(resourceOffset).equals(CacheContainerConfigurationsResource.PATH)) { resourceOffset++; } String resourceName = parentAddress.getElement(resourceOffset).getValue(); return serviceNameResolver.getServiceName(containerName, resourceName); }
@Override protected ServiceName getParentServiceName(PathAddress parentAddress) { int containerPosition = PathAddressUtils.indexOfKey(parentAddress, CacheContainerResource.CONTAINER_PATH.getKey()); String containerName = parentAddress.getElement(containerPosition).getValue(); int resourceOffset = containerPosition + 1; if (parentAddress.getElement(resourceOffset).equals(CacheContainerConfigurationsResource.PATH)) { resourceOffset++; } String resourceName = parentAddress.getElement(resourceOffset).getValue(); return serviceNameResolver.getServiceName(containerName, resourceName); }