@SuppressWarnings("deprecation") @Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor).addRequiredChildren(PartitionHandlingResourceDefinition.PATH, StateTransferResourceDefinition.PATH, BackupForResourceDefinition.PATH, BackupsResourceDefinition.PATH); } }
@Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor).addExtraParameters(DeprecatedAttribute.class); } }
@Override protected ModelNode correctValue(ModelNode toResolve, boolean isGeneratedWriteAttribute) { return this.corrector.apply(toResolve); } }
@Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor).addCapabilities(Capability.class); } }
@Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor).addAttributes(Attribute.class); } }
@Override public O apply(Object key, O operable) { // Transactional caches must operate on a copy of the operable object O result = (operable != null) ? this.copier.apply(operable) : this.factory.get(); this.accept(result, this.operand); return !this.empty.apply(result) ? result : null; }
@Nullable static String expandUriComponent(@Nullable String source, UriTemplateVariables uriVariables, @Nullable UnaryOperator<String> encoder) { if (source == null) { return null; } if (source.indexOf('{') == -1) { return source; } if (source.indexOf(':') != -1) { source = sanitizeSource(source); } Matcher matcher = NAMES_PATTERN.matcher(source); StringBuffer sb = new StringBuffer(); while (matcher.find()) { String match = matcher.group(1); String varName = getVariableName(match); Object varValue = uriVariables.getValue(varName); if (UriTemplateVariables.SKIP_VALUE.equals(varValue)) { continue; } String formatted = getVariableValueAsString(varValue); formatted = encoder != null ? encoder.apply(formatted) : Matcher.quoteReplacement(formatted); matcher.appendReplacement(sb, formatted); } matcher.appendTail(sb); return sb.toString(); }
/** * This form allows a lambda to be used as the builder * * @param typeName the name of the type to wire * @param builderFunction a function that will be given the builder to use * * @return the same builder back please */ public static TypeRuntimeWiring newTypeWiring(String typeName, UnaryOperator<Builder> builderFunction) { return builderFunction.apply(newTypeWiring(typeName)).build(); }
@Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor) .addAttributes(Attribute.class) // Translate deprecated DATASOURCE attribute to DATA_SOURCE attribute .addAttributeTranslation(DeprecatedAttribute.DATASOURCE, DATA_SOURCE_TRANSLATION) ; } }
private void registerTransformedOperation(ManagementResourceRegistration registration, OperationDefinition definition, OperationStepHandler handler) { // Only override global operation handlers for non-identity transformations OperationStepHandler transformedHandler = this.descriptor.getOperationTransformation().apply(handler); if (handler != transformedHandler) { registration.registerOperationHandler(definition, transformedHandler); } } }
/** * This form allows a lambda to be used as the builder of a type wiring * * @param typeName the name of the type to wire * @param builderFunction a function that will be given the builder to use * * @return the runtime wiring builder */ public Builder type(String typeName, UnaryOperator<TypeRuntimeWiring.Builder> builderFunction) { TypeRuntimeWiring.Builder builder = builderFunction.apply(TypeRuntimeWiring.newTypeWiring(typeName)); return type(builder.build()); }
public Builder context(UnaryOperator<GraphQLContext.Builder> contextBuilderFunction) { GraphQLContext.Builder builder = GraphQLContext.newContext(); builder = contextBuilderFunction.apply(builder); return context(builder.build()); }
HttpServerAuthenticationMechanism doCreate(final String name, final CallbackHandler callbackHandler, final UnaryOperator<HttpServerAuthenticationMechanismFactory> factoryTransformation) throws HttpAuthenticationException { HttpServerAuthenticationMechanism server = new SecurityIdentityServerMechanismFactory(factoryTransformation.apply(getFactory())).createAuthenticationMechanism(name, Collections.emptyMap(), callbackHandler); log.tracef("Created HttpServerAuthenticationMechanism [%s] for mechanism [%s]", server, name); return server; }
@Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor) .addAttributes(Attribute.class) .setAddOperationTransformation(new LegacyAddOperationTransformation(Attribute.class)) .setOperationTransformation(LEGACY_OPERATION_TRANSFORMER) ; } }
@Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor) .addAttributes(Attribute.class) .setAddOperationTransformation(new LegacyAddOperationTransformation(Attribute.class)) .setOperationTransformation(LEGACY_OPERATION_TRANSFORMER) ; } }
/** * Creates a new capability based on the specified requirement * @param requirement the requirement basis * @param configurator configures the capability */ public RequirementCapability(Requirement requirement, UnaryOperator<RuntimeCapability.Builder<Void>> configurator) { this.definition = configurator.apply(RuntimeCapability.Builder.of(requirement.getName()).setServiceType(requirement.getType())).build(); }
@Override public ResourceDescriptor apply(ResourceDescriptor descriptor) { return this.configurator.apply(descriptor) .addAttributes(Attribute.class) .addAttributes(DeprecatedAttribute.class) .addCapabilities(Capability.class) .addResourceCapabilityReference(new ResourceCapabilityReference(Capability.TRANSPORT, JGroupsTransportResourceDefinition.Requirement.CHANNEL, UnaryCapabilityNameResolver.PARENT)) ; } }
@Override public void register(ManagementResourceRegistration registration) { registration.registerOperationHandler(new SimpleOperationDefinitionBuilder(ModelDescriptionConstants.REMOVE, this.descriptor.getDescriptionResolver()).withFlag(this.flag).build(), this.descriptor.getOperationTransformation().apply(this)); } }
@Override public ManagementResourceRegistration register(ManagementResourceRegistration parent) { ManagementResourceRegistration registration = parent.registerSubModel(this); ResourceDescriptor descriptor = this.configurator.apply(new ResourceDescriptor(this.getResourceDescriptionResolver())) .addAttributes(ElectionPolicyResourceDefinition.Attribute.class) .addCapabilities(ElectionPolicyResourceDefinition.Capability.class) ; ResourceServiceHandler handler = new SimpleResourceServiceHandler(this.serviceConfiguratorFactory); new SimpleResourceRegistration(descriptor, handler).register(registration); return registration; } }
@Override public ManagementResourceRegistration register(ManagementResourceRegistration parent) { ManagementResourceRegistration registration = parent.registerSubModel(this); ResourceDescriptor descriptor = this.configurator.apply(new ResourceDescriptor(this.getResourceDescriptionResolver())) .addAttributes(Attribute.class) .addCapabilities(Capability.class) ; new SimpleResourceRegistration(descriptor, new SimpleResourceServiceHandler(this.serviceConfiguratorFactory)).register(registration); return registration; } }