Class ScoreOperationChainHandler
- java.lang.Object
-
- uk.gov.gchq.gaffer.store.operation.handler.ScoreOperationChainHandler
-
- All Implemented Interfaces:
OperationHandler<ScoreOperationChain>
,OutputOperationHandler<ScoreOperationChain,Integer>
public class ScoreOperationChainHandler extends Object implements OutputOperationHandler<ScoreOperationChain,Integer>
Operation Handler for ScoreOperationChain
-
-
Constructor Summary
Constructors Constructor Description ScoreOperationChainHandler(String namedOperationCacheNameSuffix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
doOperation(ScoreOperationChain operation, Context context, Store store)
Returns the OperationChainLimiter score for the OperationChain provided.Map<String,Integer>
getAuthScores()
int
getChainScore(Operations<?> operations, User user)
Map<Class<? extends Operation>,ScoreResolver>
getDefaultScoreResolvers()
int
getMaxUserAuthScore(Set<String> opAuths)
Iterates through each of the users operation authorisations listed in the config file and returns the highest score associated with those auths.Map<Class<? extends Operation>,Integer>
getOpScores()
Map<String,Integer>
getOpScoresAsStrings()
Map<Class<? extends Operation>,ScoreResolver>
getScoreResolvers()
String
getSuffixNamedOperationCacheName()
void
setAuthScores(Map<String,Integer> authScores)
void
setOpScores(Map<Class<? extends Operation>,Integer> opScores)
void
setOpScoresFromStrings(Map<String,Integer> opScores)
void
setScoreResolvers(Map<Class<? extends Operation>,ScoreResolver> resolvers)
void
validateOpScores()
-
-
-
Constructor Detail
-
ScoreOperationChainHandler
public ScoreOperationChainHandler(String namedOperationCacheNameSuffix)
-
-
Method Detail
-
getSuffixNamedOperationCacheName
public String getSuffixNamedOperationCacheName()
-
doOperation
public Integer doOperation(ScoreOperationChain operation, Context context, Store store) throws OperationException
Returns the OperationChainLimiter score for the OperationChain provided.- Specified by:
doOperation
in interfaceOperationHandler<ScoreOperationChain>
- Specified by:
doOperation
in interfaceOutputOperationHandler<ScoreOperationChain,Integer>
- Parameters:
operation
- theOperation
to be executedcontext
- the operation chain context, containing the user who executed the operationstore
- theStore
the operation should be run on- Returns:
- an Integer containing the score
- Throws:
OperationException
- thrown if the property keys have not been set
-
getChainScore
public int getChainScore(Operations<?> operations, User user)
-
getMaxUserAuthScore
public int getMaxUserAuthScore(Set<String> opAuths)
Iterates through each of the users operation authorisations listed in the config file and returns the highest score associated with those auths.Defaults to 0.
- Parameters:
opAuths
- a set of operation authorisations- Returns:
- maxUserScore the highest score associated with any of the supplied user auths
-
setOpScoresFromStrings
public void setOpScoresFromStrings(Map<String,Integer> opScores) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
getScoreResolvers
public Map<Class<? extends Operation>,ScoreResolver> getScoreResolvers()
-
setScoreResolvers
public void setScoreResolvers(Map<Class<? extends Operation>,ScoreResolver> resolvers)
-
validateOpScores
public void validateOpScores()
-
getDefaultScoreResolvers
public Map<Class<? extends Operation>,ScoreResolver> getDefaultScoreResolvers()
-
-