T - The type of the initial service which is provided after the first
phase of bootstrapping.public class TwoPhasePlatform<T extends ADEPT2Service> extends AristaFlowPlatform
If no initial service is provided, the platform will be completely started
after the first phase. In this case the method
will return null.
If you bootstrapped in two phases, you can also terminate in two reverse
phases: terminateToInitialService() will shut down all services
started after the initial service and AristaFlowPlatform.terminate() will afterwards
terminate the remaining services and the platform itself. Make sure (using
finally) to call AristaFlowPlatform.terminate()! If you just call
AristaFlowPlatform.terminate() without terminateToInitialService(), the
platform will be terminated completely in one step.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Class<T> |
initialServiceCls
The class of the initial service.
|
protected java.lang.String |
initialServiceType
The type name of the initial service.
|
protected static boolean |
TEST_SINGLETON
Whether to start as singleton or to allow multiple instances.
|
confMgr| Modifier | Constructor and Description |
|---|---|
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType)
Creates a new
TwoPhasePlatform. |
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
boolean eager)
Creates a new
TwoPhasePlatform. |
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
boolean eager,
Configuration conf)
Creates a new
TwoPhasePlatform. |
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
boolean eager,
Configuration conf,
ConfigurationPropertyProvider provider)
Creates a new
TwoPhasePlatform. |
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
boolean eager,
ConfigurationPropertyProvider provider)
Creates a new
TwoPhasePlatform. |
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
Configuration conf)
Creates a new
TwoPhasePlatform. |
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
Configuration conf,
ConfigurationPropertyProvider provider)
Creates a new
TwoPhasePlatform. |
|
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
ConfigurationPropertyProvider provider)
Creates a new
TwoPhasePlatform. |
protected |
TwoPhasePlatform(java.lang.Class<T> initialServiceCls,
java.lang.String initialServiceType,
java.lang.String rootConfFileName,
Configuration providedConfiguration,
boolean eager,
ConfigurationPropertyProvider provider)
Creates a new
TwoPhasePlatform. |
| Modifier and Type | Method and Description |
|---|---|
GlobalRegistry |
continueBootstrap()
Continues the bootstrap.
|
protected BootstrapRegistry |
createBootstrapRegistry(UrlConfigurationManager confMgr)
Creates a new bootstrap registry having the designated configuration
manager.
|
protected GlobalRegistry |
globalRegistryChanged(SessionToken session,
java.net.URI globRegUri)
Notifies the bootstrap registry that the URI of the global registry has
changed to the designated URI.
|
T |
startBootstrap()
Bootstraps the platform partially, that is, just for retrieving the initial
service.
|
T |
terminateToInitialService()
Terminates all services until the initial service.
|
bootstrap, bootstrap, createConfigurationManager, getBootstrapRegistry, getClientService, getRegistry, getRootConfiguration, terminate, terminateSafelyprotected static boolean TEST_SINGLETON
This is only for testing purpose! Always reset it in a finally-clause.
protected final java.lang.Class<T extends ADEPT2Service> initialServiceCls
protected final java.lang.String initialServiceType
public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType) throws AbortServiceException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.AbortServiceException - If the platform has already been bootstrapped
or the initialisation or starting of the registry fails, an
AbortServiceException will be thrown.AristaFlowPlatform.AristaFlowPlatform()public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, ConfigurationPropertyProvider provider) throws AbortServiceException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.provider - The provider for the global properties including the
configuration directories to load additional configurations for
the root configuration from. This must not be null.AbortServiceException - If the platform has already been bootstrapped
or the initialisation or starting of the registry fails, an
AbortServiceException will be thrown.AristaFlowPlatform.AristaFlowPlatform(ConfigurationPropertyProvider)public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, Configuration conf) throws AbortServiceException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.conf - The configuration provided when bootstrapping. This may either
be a complete root configuration (without additional configuration
directories), a delta configuration complementing or overriding
the configurations from the configuration directories or even
null. If this is null, only
configurations from the configuration directories will be used but
this requires a valid rootConfFileName.AbortServiceException - If the platform has already been bootstrapped
or the initialisation or starting of the registry fails, an
AbortServiceException will be thrown.AristaFlowPlatform.AristaFlowPlatform(Configuration)public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, Configuration conf, ConfigurationPropertyProvider provider) throws AbortServiceException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.conf - The configuration provided when bootstrapping. This may either
be a complete root configuration (without additional configuration
directories), a delta configuration complementing or overriding
the configurations from the configuration directories or even
null. If this is null, only
configurations from the configuration directories will be used but
this requires a valid rootConfFileName.provider - The provider for the global properties including the
configuration directories to load additional configurations for
the root configuration from. This must not be null.AbortServiceException - If the platform has already been bootstrapped
or the initialisation or starting of the registry fails, an
AbortServiceException will be thrown.AristaFlowPlatform.AristaFlowPlatform(Configuration,
ConfigurationPropertyProvider)public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, boolean eager) throws ConfigurationException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.eager - Whether to (transitively) load all referenced configuration
files for the root configuration.ConfigurationException - If
ConfigurationException will be thrown.AristaFlowPlatform.AristaFlowPlatform(boolean)public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, boolean eager, ConfigurationPropertyProvider provider) throws ConfigurationException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.eager - Whether to (transitively) load all referenced configuration
files for the root configuration.provider - The provider for the global properties including the
configuration directories to load additional configurations for
the root configuration from. This must not be null.ConfigurationException - If
ConfigurationException will be thrown.AristaFlowPlatform.AristaFlowPlatform(boolean, ConfigurationPropertyProvider)public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, boolean eager, Configuration conf) throws ConfigurationException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.eager - Whether to (transitively) load all referenced configuration
files for the root configuration.conf - The configuration provided when bootstrapping. This may either
be a complete root configuration (without additional configuration
directories), a delta configuration complementing or overriding
the configurations from the configuration directories or even
null. If this is null, only
configurations from the configuration directories will be used but
this requires a valid rootConfFileName.ConfigurationException - If
ConfigurationException will be thrown.AristaFlowPlatform.AristaFlowPlatform(boolean, Configuration)public TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, boolean eager, Configuration conf, ConfigurationPropertyProvider provider) throws ConfigurationException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.eager - Whether to (transitively) load all referenced configuration
files for the root configuration.conf - The configuration provided when bootstrapping. This may either
be a complete root configuration (without additional configuration
directories), a delta configuration complementing or overriding
the configurations from the configuration directories or even
null. If this is null, only
configurations from the configuration directories will be used but
this requires a valid rootConfFileName.provider - The provider for the global properties including the
configuration directories to load additional configurations for
the root configuration from. This must not be null.ConfigurationException - If
ConfigurationException will be thrown.AristaFlowPlatform.AristaFlowPlatform(boolean, Configuration,
ConfigurationPropertyProvider)protected TwoPhasePlatform(java.lang.Class<T> initialServiceCls, java.lang.String initialServiceType, java.lang.String rootConfFileName, Configuration providedConfiguration, boolean eager, ConfigurationPropertyProvider provider) throws ConfigurationException
TwoPhasePlatform.initialServiceCls - The class of the initial service. If this is
null, this registry will act like the normal
BootstrapRegistry.initialServiceType - The type name of the initial service. If this is
null or the empty string, this registry will act like
the normal BootstrapRegistry.rootConfFileName - The name of the file (relative to the configuration
directory/directories) containing the root configuration that is
searched for in the configuration directories specified by the
designated provider. This may be null but then the
designated configuration has to be a complete root configuration.providedConfiguration - The configuration provided when bootstrapping.
This may either be a complete root configuration (without
additional configuration directories), a delta configuration
complementing or overriding the configurations from the
configuration directories or even null. If this is
null, only configurations from the configuration
directories will be used but this requires a valid
rootConfFileName.eager - Whether to (transitively) load all referenced configuration
files for the root configuration.provider - The provider for the global properties including the
configuration directories to load additional configurations for
the root configuration from. This must not be null.ConfigurationException - If
ConfigurationException will be thrown.AristaFlowPlatform.AristaFlowPlatform(Configuration,
ConfigurationPropertyProvider)protected BootstrapRegistry createBootstrapRegistry(UrlConfigurationManager confMgr) throws AbortServiceException
AristaFlowPlatformcreateBootstrapRegistry in class AristaFlowPlatformconfMgr - The initial configuration manager that provides the root
configuration and configurations for the loaded component
instances.ConfigurationException - If the registry configuration is invalid, a
ConfigurationExceptionwill be thrown.AbortServiceException - If the initialisation or starting of the
registry fails, an AbortServiceException will be
thrown.public T startBootstrap() throws AbortServiceException
null if no initial service is specified.AbortServiceException - If the platform has already been bootstrapped
or the initialisation or starting of the registry fails, an
AbortServiceException will be thrown.AristaFlowPlatform.bootstrap()public GlobalRegistry continueBootstrap() throws AbortServiceException
AbortServiceException - If there are problems preparing the security
manager or starting one of the services to be automatically
started, an AbortServiceException will be thrown.TwoPhaseBootstrap.continueBootstrap()public T terminateToInitialService()
null if no initial service is specified or
bootstrapping has not proceeded to the initial service.protected GlobalRegistry globalRegistryChanged(SessionToken session, java.net.URI globRegUri) throws ServiceNotKnownException
session - The session which is used to check for access rights on this
method.globRegUri - The new URI of the global registry.ServiceNotKnownException - If the default instance of the global
registry cannot be retrieved with the new URI, a
ServiceNotKnownException will be thrown.