Class AuthenticatedInjectedService
- java.lang.Object
-
- de.aristaflow.adept2.core.registry.InjectedADEPT2Service
-
- de.aristaflow.adept2.core.registry.InitialisedInjectedService
-
- de.aristaflow.adept2.core.registry.AuthenticatedInjectedService
-
- All Implemented Interfaces:
ADEPT2Service
,LogService
,ServiceThreadHandling
- Direct Known Subclasses:
ClusterNode
@ConfigurationDescription(properties={@Property(name="ServiceAuthUserName",type=STRING,defaultValue="${arflow:confVar.SystemUserName}"),,}) public abstract class AuthenticatedInjectedService extends InitialisedInjectedService
This class is similar toAbstractAuthenticatedService
. LikeInitialisedInjectedService
this injected service will not be of much use before initialised by the platform. For instance, there will be no session factory, so no creation and no verification of session tokens can take place. Check withInitialisedInjectedService.isInitialised()
whether the injected service is usable. Methods that usually wait for this service to be started, will not block but throw an exception before the initialisation. This is similar to their behaviour after the service has been shut down.
-
-
Field Summary
-
Fields inherited from class de.aristaflow.adept2.core.registry.InitialisedInjectedService
adept2Service, loggerClass, NOT_INITIALISED_EXCEPTION
-
Fields inherited from class de.aristaflow.adept2.core.registry.InjectedADEPT2Service
EMPTY_STRING_ARRAY, logger, runtimeRequiredServices, startupRequiredServices
-
-
Constructor Summary
Constructors Constructor Description AuthenticatedInjectedService(Logger logger)
Creates an injected service that can be initialised by the platform and provides a session factory.AuthenticatedInjectedService(Logger logger, String[] startupRequiredServices, String[] runtimeRequiredServices, Class<?> cls)
Creates an injected service that can be initialised by the platform and provides a session factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected SessionToken
createChildSession(SessionToken parentSession)
protected SessionToken
createSession()
protected QualifiedAgent
getAgent(SessionToken session)
SerialisableTriple<String,String,String>
getServiceInstanceName()
Gets the (optional) cluster name, the unique node name and the hierarchical instance name of this service.protected SessionFactory
getSessionFactory()
protected QualifiedAgent
getTopLevelAgent(SessionToken session)
protected Pair<QualifiedAgent,QualifiedAgent>
getUserCredentials(SessionToken session)
void
initPlatform(org.apache.commons.configuration2.Configuration conf, Registry registry)
Creates a wrappedAbstractAuthenticatedService
.protected boolean
sessionHasAllCapabilities(SessionToken session, String... capabilities)
protected boolean
sessionHasCapability(SessionToken session, String capability)
Deprecated.UsesessionHasOneCapability(SessionToken, String...)
instead.protected boolean
sessionHasOneCapability(SessionToken session, String... capabilities)
-
Methods inherited from class de.aristaflow.adept2.core.registry.InitialisedInjectedService
_sessionActive, _sessionFinished, changeLogContext, changeLogContext, changeLogContext, csvLoggingEnabled, getClassSpecificJulLogger, getLogger, getRelease, init, isActive, isInitialised, logMethodEntry, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, privilegeThread, revertLogContextChanges, sessionActive, sessionActive, sessionActive, sessionFinished, shutdown, signalShutdown, signalStart, start, unprivilegeThread
-
Methods inherited from class de.aristaflow.adept2.core.registry.InjectedADEPT2Service
getLocalUris, getRuntimeRequiredServices, getStartupRequiredServices, getURIs, ping, preShutdown
-
-
-
-
Constructor Detail
-
AuthenticatedInjectedService
public AuthenticatedInjectedService(Logger logger)
Creates an injected service that can be initialised by the platform and provides a session factory. It assumes that there are no other services required.- Parameters:
logger
- The logger which to use for this service. This will only be used until initialisation by the platform. Afterwards the logger of theAbstractADEPT2Service
will be used.
-
AuthenticatedInjectedService
public AuthenticatedInjectedService(Logger logger, String[] startupRequiredServices, String[] runtimeRequiredServices, Class<?> cls)
Creates an injected service that can be initialised by the platform and provides a session factory. It uses the designated services from the platform.- Parameters:
logger
- The logger which to use for this service. This will only be used until initialisation by the platform. Afterwards the logger of theAbstractADEPT2Service
will be used.startupRequiredServices
- The service type names of services required at startup time (inInitialisedInjectedService.init(URI[], URI[])
andInitialisedInjectedService.start()
).runtimeRequiredServices
- The service type names of services required at runtime (after startup time).cls
- The class which to use for the logger provided byAbstractADEPT2Service
, this is usually the interface of the service.
-
-
Method Detail
-
initPlatform
public void initPlatform(org.apache.commons.configuration2.Configuration conf, Registry registry) throws AbortServiceException
Creates a wrappedAbstractAuthenticatedService
.- Overrides:
initPlatform
in classInitialisedInjectedService
- Parameters:
conf
- The configuration provided by the platform.registry
- The registry allowing to access the platform.- Throws:
AbortServiceException
- If there are problems initialising this service, anAbortServiceException
will be thrown.
-
getServiceInstanceName
public SerialisableTriple<String,String,String> getServiceInstanceName()
Description copied from interface:ADEPT2Service
Gets the (optional) cluster name, the unique node name and the hierarchical instance name of this service.- Specified by:
getServiceInstanceName
in interfaceADEPT2Service
- Overrides:
getServiceInstanceName
in classInjectedADEPT2Service
- Returns:
- The (optional) cluster name, the unique node name and the hierarchical instance name of this service.
-
getSessionFactory
protected SessionFactory getSessionFactory()
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.getSessionFactory()
-
createSession
protected SessionToken createSession()
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.createSession()
-
createChildSession
protected SessionToken createChildSession(SessionToken parentSession)
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.createChildSession(SessionToken)
-
sessionHasCapability
@Deprecated protected boolean sessionHasCapability(SessionToken session, String capability)
Deprecated.UsesessionHasOneCapability(SessionToken, String...)
instead.- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.sessionHasCapability(SessionToken, String)
-
sessionHasOneCapability
protected boolean sessionHasOneCapability(SessionToken session, String... capabilities)
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.sessionHasOneCapability(SessionToken, String...)
-
sessionHasAllCapabilities
protected boolean sessionHasAllCapabilities(SessionToken session, String... capabilities)
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.sessionHasAllCapabilities(SessionToken, String...)
-
getUserCredentials
protected Pair<QualifiedAgent,QualifiedAgent> getUserCredentials(SessionToken session)
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.getUserCredentials(SessionToken)
-
getTopLevelAgent
protected QualifiedAgent getTopLevelAgent(SessionToken session)
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.getTopLevelAgent(SessionToken)
-
getAgent
protected QualifiedAgent getAgent(SessionToken session)
- Throws:
InvalidServiceStateException
- If this service has not been initialised by the platform yet, anInvalidServiceStateException
will be thrown.- See Also:
AbstractAuthenticatedService.getAgent(SessionToken)
-
-