Class LocalServiceRegistry.ConfigurationValidator
java.lang.Object
de.aristaflow.adept2.base.configuration.ConfigurationValidator
de.aristaflow.adept2.base.registry.PluginRegistry.ConfigurationValidator
de.aristaflow.adept2.base.registry.LocalServiceRegistry.ConfigurationValidator
- Direct Known Subclasses:
ServiceRegistry.ConfigurationValidator
- Enclosing class:
- LocalServiceRegistry
public static class LocalServiceRegistry.ConfigurationValidator
extends PluginRegistry.ConfigurationValidator
Checks the configuration of the
LocalServiceRegistry.-
Field Summary
Fields inherited from class de.aristaflow.adept2.base.configuration.ConfigurationValidator
declaration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckForNonExportedLocal(Configuration configuration, String serviceType) Checks whether the instances of the designated service type are exported or published in the designated properties.checkLocalServices(Configuration configuration, String serviceType) Checks whether all instances of the designated service type are local services, that is each of them provides an implementation (class or object) and none of them is a private remote service.getServiceInstances(Configuration configuration, String serviceType) Gets the names of all component instances of the designated service type, that is the declared instances or the anonymous instance if there are no declared ones.protected voidvalidate(Configuration configuration) Checks that the model factory registry is a local service since the registry needs it for creating any service or plugin.Methods inherited from class de.aristaflow.adept2.base.registry.PluginRegistry.ConfigurationValidator
checkAllPluginTypes, checkPluginDeclaration, checkPluginInstances, checkRuntimePluginDeclarationMethods inherited from class de.aristaflow.adept2.base.configuration.ConfigurationValidator
rebuke, rebukeIllegalValue, rebukeMissingValue
-
Constructor Details
-
ConfigurationValidator
public ConfigurationValidator()
-
-
Method Details
-
getServiceInstances
Gets the names of all component instances of the designated service type, that is the declared instances or the anonymous instance if there are no declared ones. This does not check whether the service type is declared at all.- Parameters:
configuration- The configuration providing the declared instances of the designated service type.serviceType- The name of the service type to get the instances of.- Returns:
- The names of the declared instances of the designated service type or the name of the service type denoting the anonymous instance. This will never be null nor empty.
-
checkLocalServices
protected List<String> checkLocalServices(Configuration configuration, String serviceType) throws ConfigurationException Checks whether all instances of the designated service type are local services, that is each of them provides an implementation (class or object) and none of them is a private remote service. Since a registry can only create local services, this is required for each service type the registry itself needs.
In case there are no declared instances, the anonymous instance needs to be a local service. Therefore this also ensures that at least one instance of the designated service type is available.- Parameters:
configuration- The configuration to check for implementations and service URIs of the instances of the designated service type.serviceType- The name of the service type to check the instances of.- Returns:
- The names of the checked instances of the designated service type. This will never be null nor empty.
- Throws:
ConfigurationException- If an instance of the designated service type does not provide an implementation or provides a service URI, aConfigurationExceptionwill be thrown.
-
checkForNonExportedLocal
protected void checkForNonExportedLocal(Configuration configuration, String serviceType) throws ConfigurationException Checks whether the instances of the designated service type are exported or published in the designated properties. If so, they will be rebuked.- Parameters:
configuration- The configuration to check for export or publish properties.serviceType- The name of the service type to check the instances of.- Throws:
ConfigurationException- If an instance of the designated service type is exported or published, aConfigurationExceptionwill be thrown.
-
validate
Checks that the model factory registry is a local service since the registry needs it for creating any service or plugin. Furthermore this checks that noJDBC_DATA_SOURCEis exported. This does not work sinceConnections are not serialisable.- Overrides:
validatein classPluginRegistry.ConfigurationValidator- Parameters:
configuration- The configuration to check for properly configured plugin types.- Throws:
ConfigurationException- If there are incorrectly configured plugin types in the designated configuration, aConfigurationExceptionwill be thrown.- See Also:
-