mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Add extensibility framework for allocation tokens
This uses an extensibility mechanism similar to that of WhoisCommandFactory and CustomLogicFactory, namely, that a fully qualified Java class is specified in the YAML file for each environment with the allocation token custom logic to be used. By default, this points to a no-op base class that does nothing. Users that wish to add their own allocation token custom logic can simply create a new class that extends AllocationTokenCustomLogic and then configure it in their .yaml config files. This also renames the existing *FlowCustomLogic *Flow instance variables from customLogic to flowCustomLogic, to avoid the potential confusion with the new AllocationTokenCustomLogic class that also now exists. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=183003112
This commit is contained in:
parent
e6a097a590
commit
9d532cb507
17 changed files with 320 additions and 61 deletions
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2017 The Nomulus Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.flows.domain.token;
|
||||
|
||||
import static google.registry.util.TypeUtils.getClassFromString;
|
||||
import static google.registry.util.TypeUtils.instantiate;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
|
||||
/** Dagger module for allocation token classes. */
|
||||
@Module
|
||||
public class AllocationTokenModule {
|
||||
|
||||
@Provides
|
||||
static AllocationTokenCustomLogic provideAllocationTokenCustomLogic(
|
||||
@Config("allocationTokenCustomLogicClass") String customClass) {
|
||||
return instantiate(getClassFromString(customClass, AllocationTokenCustomLogic.class));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue