Class BootstrapRegistry
- java.lang.Object
-
- de.aristaflow.adept2.base.service.AbstractADEPT2Service
-
- de.aristaflow.adept2.base.service.AbstractAuthenticatedService
-
- de.aristaflow.adept2.base.registry.AbstractRegistry
-
- de.aristaflow.adept2.base.registry.PluginRegistry
-
- de.aristaflow.adept2.base.registry.InstanceToInstanceRegistry
-
- de.aristaflow.adept2.base.registry.LocalServiceRegistry
-
- de.aristaflow.adept2.base.registry.ServiceRegistry
-
- de.aristaflow.adept2.core.registry.BootstrapRegistry
-
- All Implemented Interfaces:
GlobalInvocationResolver
,GlobalRegistryServiceProvider
,ConfMgrRegistry
,ADEPT2Service
,AuthenticatingService
,LogService
,NameResolution
,ServiceThreadHandling
- Direct Known Subclasses:
TwoPhaseBootstrap
@ConfigurationDescription(properties={@Property(name="Components.ClientService",isRequired=true,description="A required service to provide clients convenient access to platform services."),,,,,,}) public class BootstrapRegistry extends ServiceRegistry
This bootstrap registry is the central entity from which other registries and services can be retrieved. Therefore this registry kind of represents the whole platform. After bootstrapping, the convenience methods for the client service and the registry (wrapper) can be used. While the client service provides access to services for usage by clients, the registry wrapper provides access the way server services have.
Bootstrapping consists of creating the bootstrap registry which implicitly validates its configuration and the actual bootstrapping.The configuration of a bootstrap registry requires the client service, a security manager identifying an org model manager which will be used for authentication in the platform as well as an arbitrary instance name for the registry. The name is used for logging and identifying the API user of the registry (client service and registry wrapper).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.ServiceRegistry
ServiceRegistry.ConfigurationValidator
-
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.LocalServiceRegistry
LocalServiceRegistry.ServiceExportInformation, LocalServiceRegistry.ServiceNameResolution, LocalServiceRegistry.ServiceStarter
-
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.PluginRegistry
PluginRegistry.URLClassloaderPrivilegedAction
-
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry
AbstractRegistry.DefaultNameResolution, AbstractRegistry.InstanceInformation, AbstractRegistry.InstantiationMode
-
Nested classes/interfaces inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
AbstractADEPT2Service.ActiveSessions
-
-
Field Summary
Fields Modifier and Type Field Description protected String
instanceName
The name of the bootstrap registry, which equals the configured name of the platform (client or server).-
Fields inherited from class de.aristaflow.adept2.base.registry.ServiceRegistry
clusterName, GLOB_STUB_CACHING_REM_IT_ALIVE_TIME_EXTENSION, GLOB_STUB_CACHING_REM_IT_INIT_ALIVE_TIME, GLOB_STUB_PROXY_ANNOT_CACHE_SIZE, GLOB_STUB_PROXY_LAZY_METHOD_VALID_TIME, globalRegCache, hierInstName, protocolPriority, reexportedServices
-
Fields inherited from class de.aristaflow.adept2.base.registry.LocalServiceRegistry
autoStartServices, failedServices, gsmAvailable, nodeName, release, serviceStarterPool, serviceStartLocker, shuttingDown, startedServices, startingLock, startingRequiredServices, startingService
-
Fields inherited from class de.aristaflow.adept2.base.registry.InstanceToInstanceRegistry
usedInstances
-
Fields inherited from class de.aristaflow.adept2.base.registry.PluginRegistry
declaredPluginTypes, defaultInstances, dynamicPlugins, pluginInstances, runtimePlugins, runtimePluginTypeCLs, singletonPlugins
-
Fields inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry
componentInterfaces, configurationManager, declaredInstances, INIT_INSTANTIATED_OBJECT_METHOD, nameResolution, singletonInstances
-
Fields inherited from class de.aristaflow.adept2.base.service.AbstractAuthenticatedService
CFG_EARLY_SERVICEAUTH_ORGPOSID, CFG_EARLY_SERVICEAUTH_ORGPOSNAME, CFG_EARLY_SERVICEAUTH_PASSWORD, CFG_EARLY_SERVICEAUTH_USERNAME, CFG_SERVICEAUTH_ORGPOSID, CFG_SERVICEAUTH_ORGPOSNAME, CFG_SERVICEAUTH_PASSWORD, CFG_SERVICEAUTH_USERNAME
-
Fields inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
CONF_CSV_LOGGING, configuration, logger, registry, runtimeRequiredServices, startupRequiredServices
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BootstrapRegistry(UrlConfigurationManager confMgr, Class<? extends BootstrapRegistry> bootstrapClass)
Creates a new bootstrap registry having the designated configuration manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
bootstrap()
Bootstraps this registry and therefore the platform.protected ClientService
getClientService()
Gets the client service providing convenient access to the services provided by this registry and needed by client components.protected Registry
getRegistry()
Gets the wrapper for access to this registry via theRegistry
-interface.GlobalSecurityManager
prepareGlobalSecurityManager()
Prepares the security manager that is, the global security manager will be retrieved (and started) if necessary.protected Pair<String,String>
resolveInstanceName(org.apache.commons.configuration2.Configuration conf)
Gets the cluster and the instance name for this registry from the designated configuration.void
shutdown(boolean emergency)
Shut down all started services.protected void
terminate(boolean emergency, String hierServName)
Terminates all started services or until the designated service and signals the shutdown of this registry.-
Methods inherited from class de.aristaflow.adept2.base.registry.ServiceRegistry
autoStartServices, beforeLocalTermination, checkServiceURI, chooseAppropriateURI, createMBeanName, createRegistryWrapper, exportService, getCommunicationService, getGlobalRegistry, getInstanceNameFromServiceURI, getInvocationTarget, getLocallyExportedService, getLocalServiceObject, getService, getService, getServiceInformation, globalRegistryChanged, init, initExportServices, invalidateGlobalRegistry, prepareExport, prioritiseProtocols, readMetaConfiguration, start, unpublishService
-
Methods inherited from class de.aristaflow.adept2.base.registry.LocalServiceRegistry
checkServiceInterface, checkServiceUriSyntax, checkStartupRequiredService, createLocalServiceURI, determineNodeName, getAndCheckRequiredService, getConfiguredPlugin, getGlobalSequence, getInstantiationMode, getRegistry, getSecurityManager, getServiceForInstance, notifyDataSourceToConfMgr, registryActive, renewConfiguration, startLocalService, syncExecute, terminateService
-
Methods inherited from class de.aristaflow.adept2.base.registry.InstanceToInstanceRegistry
getUsedComponentInstanceNameForInstance, getUsedObjectForInstance
-
Methods inherited from class de.aristaflow.adept2.base.registry.PluginRegistry
createPluginLoader, getConfiguredPlugin, getConfiguredPlugin, getConfiguredPlugins, getConfiguredPluginTypes, prepareRuntimePlugin, readMetaConfiguration
-
Methods inherited from class de.aristaflow.adept2.base.registry.AbstractRegistry
checkAndStoreProvidedObject, checkConfiguration, checkImplementingClass, checkSupertype, createInstanceForInterface, getAppropriateMethod, getArbitrarilyNamedObject, getComponentType, getFormattedSignature, getHierarchicalInstanceName, getInstanceInformation, getInterfaceForComponentType, getNames, getObjectForInstanceName, getObjectForInstanceName, getObjectForInstanceName, getSimpleInstanceName, initialiseInstantiatedObject
-
Methods inherited from class de.aristaflow.adept2.base.service.AbstractAuthenticatedService
_sessionActive, authenticateService, awaitActiveSessions, createChildSession, createSession, getAgent, getSessionFactory, getStartupRequired, getTopLevelAgent, getUserCredentials, globalSecurityManagerAvailable, isEarlyService, sessionHasAllCapabilities, sessionHasAllTopLevelCapabilities, sessionHasCapability, sessionHasOneCapability, sessionHasOneTopLevelCapability
-
Methods inherited from class de.aristaflow.adept2.base.service.AbstractADEPT2Service
_sessionFinished, activeOrInvalidServiceStateException, changeLogContext, changeLogContext, changeLogContext, consoleLog, csvLoggingEnabled, getClassSpecificJulLogger, getDependencyRegistry, getLocalUris, getLogger, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, isActive, isSessionActive, isShutdown, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, ping, preShutdown, privilegeSession, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionActive, sessionFinished, sessionFinished, signalShutdown, signalStart, unprivilegeThread
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, ping, preShutdown
-
-
-
-
Field Detail
-
instanceName
protected final String instanceName
The name of the bootstrap registry, which equals the configured name of the platform (client or server).
-
-
Constructor Detail
-
BootstrapRegistry
protected BootstrapRegistry(UrlConfigurationManager confMgr, Class<? extends BootstrapRegistry> bootstrapClass) throws AbortServiceException
Creates a new bootstrap registry having the designated configuration manager. Before creating the registry, the root configuration will be validated against the designated class.- Parameters:
confMgr
- The initial configuration manager that provides the root configuration and configurations for the loaded component instances.bootstrapClass
- The class the root configuration is validated against the configuration description. Use this class unless you have a subclass that has its own configuration description. This class is also used for retrieving the release information from the version file.- Throws:
ConfigurationException
- If the registry configuration is invalid, aConfigurationException
will be thrown.AbortServiceException
- If the initialisation or starting of the registry fails, anAbortServiceException
will be thrown.
-
-
Method Detail
-
bootstrap
protected void bootstrap() throws AbortServiceException
Bootstraps this registry and therefore the platform. The registry is initialised with either the configured URI or a local URI with the instance name. Afterwards the registry is started.- Throws:
AbortServiceException
- If the initialisation or starting of the registry fails, anAbortServiceException
will be thrown.
-
shutdown
public void shutdown(boolean emergency)
Description copied from class:LocalServiceRegistry
Shut down all started services.- Specified by:
shutdown
in interfaceADEPT2Service
- Overrides:
shutdown
in classLocalServiceRegistry
- Parameters:
emergency
- Whether the shutdown will be an emergency shutdown.
-
terminate
protected void terminate(boolean emergency, String hierServName)
Description copied from class:LocalServiceRegistry
Terminates all started services or until the designated service and signals the shutdown of this registry. If a service name is provided all services will be shut down that have been started after the designated service. The shutdown of the registry will not be signalled yet.
Just call this method again afterwards usingnull
as service name.- Overrides:
terminate
in classLocalServiceRegistry
- Parameters:
emergency
- Whether it is an emergency shutdown.hierServName
- The hierarchical name of the service until which to shutdown all services started later. If this isnull
, all services and the registry will be shut down.
-
resolveInstanceName
protected Pair<String,String> resolveInstanceName(org.apache.commons.configuration2.Configuration conf) throws ConfigurationException
Description copied from class:ServiceRegistry
Gets the cluster and the instance name for this registry from the designated configuration.Note that this method is called from the constructor and must not rely on instance fields!
- Specified by:
resolveInstanceName
in classServiceRegistry
- Parameters:
conf
- The configuration to retrieve the instance name from.- Returns:
- The cluster and the instance name for this registry from the
designated configuration. The cluster name may be
null
. - Throws:
ConfigurationException
- If the instance name does not exist in the configuration, aConfigurationException
will be thrown. However, this should never happen if the configuration is validated beforehand.
-
prepareGlobalSecurityManager
public GlobalSecurityManager prepareGlobalSecurityManager() throws ServiceNotKnownException
Description copied from class:LocalServiceRegistry
Prepares the security manager that is, the global security manager will be retrieved (and started) if necessary.
This method will be called before (auto) starting any service. Implementations may then prepare a global security manager and provide it appropriately. Before this method has been called, the security manager will authenticate locally. Afterwards it will work with the global security manager.- Specified by:
prepareGlobalSecurityManager
in classLocalServiceRegistry
- Returns:
- The prepared global security manager to use instead of the local authentication.
- Throws:
ServiceNotKnownException
- If the security manager could not be retrieved, aServiceNotKnownException
will be thrown. The registry must not continue starting in this case!!
-
getClientService
protected ClientService getClientService() throws ServiceNotKnownException
Gets the client service providing convenient access to the services provided by this registry and needed by client components.- Returns:
- The registry for usage by client components.
- Throws:
ServiceNotKnownException
- If there are problems loading the registry, aServiceNotKnownException
will be thrown.
-
getRegistry
protected Registry getRegistry() throws ServiceNotKnownException
Gets the wrapper for access to this registry via theRegistry
-interface. This is used by (server) services to access the registry. Clients should always use an appropriateclient service
. Only use this registry for very special purposes.- Returns:
- The registry wrapper for this registry.
- Throws:
ServiceNotKnownException
- If there are problems loading the registry, aServiceNotKnownException
will be thrown.
-
-