public abstract class AbstractFileServiceProvider extends Object implements ServiceProvider
If the configuration directory does not exist, it is created. If the path given is not a directory, an empty list is return and a warning message is logged. By default, the configuration directory will be located in $DIIRT_HOME/services/SERVICE_PROVIDER_NAME.
This class provides the crawling of the configuration directory and the logging of both service creation and errors.
Constructor and Description |
---|
AbstractFileServiceProvider()
Creates a new factory using the default configuration directory.
|
AbstractFileServiceProvider(File directory)
Creates a new provider that looks for configuration files in the
given directory.
|
Modifier and Type | Method and Description |
---|---|
Collection<Service> |
additionalServices()
Creates additional services that are not read from files.
|
abstract Service |
createService(File file)
Creates a service from the given file.
|
Collection<Service> |
createServices()
Creates all the service instances by crawling the configuration
directory, creating a service for each file found, and creating
the additional services.
|
File |
getDefaultConfigurationDirectory()
The default location for the configuration.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName
public AbstractFileServiceProvider(File directory)
directory
- the configuration directorypublic AbstractFileServiceProvider()
public File getDefaultConfigurationDirectory()
public abstract Service createService(File file) throws Exception
Implementors of this method need not to care about logging and service registration.
file
- a file in the configuration directoryException
- if there is a problem creating the service from the filepublic Collection<Service> additionalServices()
Implementors need not to care about logging and service registration.
public final Collection<Service> createServices()
Given that this method provides the error handling and logging, it is declared final so that subclasses cannot accidently remove it.
createServices
in interface ServiceProvider
Copyright © 2015. All rights reserved.