Package cz.metacentrum.perun.core.blImpl
Class ExtSourcesManagerBlImpl
java.lang.Object
cz.metacentrum.perun.core.blImpl.ExtSourcesManagerBlImpl
- All Implemented Interfaces:
ExtSourcesManagerBl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addExtSource
(PerunSession sess, Group group, ExtSource source) Associate external source definition with the GROUP.void
addExtSource
(PerunSession sess, Vo vo, ExtSource source) Associate external source definition with the VO.void
addExtSources
(PerunSession perunSession, Group group, List<ExtSource> sources) Associate external source definitions with the GROUP.void
addExtSources
(PerunSession perunSession, Vo vo, List<ExtSource> sources) Associate external source definitions with the VO.void
checkExtSourceAssignedToVo
(PerunSession sess, ExtSource extSource, int voId) Check if extSource is assigned to vo or not.void
checkExtSourceExists
(PerunSession sess, ExtSource extSource) checkOrCreateExtSource
(PerunSession sess, String extSourceName, String extSourceType) Checks whether the ExtSource exists, if not, then the ExtSource is created.createExtSource
(PerunSession sess, ExtSource extSource, Map<String, String> attributes) Creates an external source.void
deleteExtSource
(PerunSession sess, ExtSource extSource) Deletes an external source.void
destroy()
Destroy manager.generateCandidateGroup
(PerunSession perunSession, Map<String, String> groupSubjectData, ExtSource source, String loginPrefix) Generate a candidate group from a group subject data.generateCandidateGroups
(PerunSession perunSession, List<Map<String, String>> subjectsData, ExtSource source, String loginPrefix) Generate candidate groups from a group subject data.getAttributes
(ExtSource extSource) Gets attributes for external source.getCandidate
(PerunSession sess, ExtSource source, String login) Get the candidate from the ExtSource.getCandidate
(PerunSession perunSession, Map<String, String> subjectData, ExtSource source, String login) Get the candidate from subjectData where at least login must exists.getDataSource
(String poolName) Returns a database connection pool.getExtSourceById
(PerunSession sess, int id) Searches for the external source with specified id.getExtSourceByName
(PerunSession sess, String name) Searches for the external source using specified name.getExtSources
(PerunSession sess) Get list of all external sources.Gets the extSourcesManagerImpl for this instance.getGroupExtSources
(PerunSession sess, Group group) Get list of external sources associated with the GROUP.getInvalidUsers
(PerunSession sess, ExtSource source) Returns list of users stored by this ExtSource, which are not valid.getVoExtSources
(PerunSession sess, Vo vo) Get list of external sources associated with the VO.void
initialize
(PerunSession sess) Initialize manager.void
Loads ext source definitions from the configuration file and updates entries stored in the DB.void
removeExtSource
(PerunSession sess, Group group, ExtSource source) Remove association of the external source from the GROUP.void
removeExtSource
(PerunSession sess, Vo vo, ExtSource source) Remove association of the external source from the VO.void
removeExtSources
(PerunSession sess, Group group, List<ExtSource> sources) Remove associations of external sources from the GROUP.void
removeExtSources
(PerunSession sess, Vo vo, List<ExtSource> sources) Remove associations of external sources from the VO.void
setPerunBl
(PerunBl perunBl)
-
Constructor Details
-
ExtSourcesManagerBlImpl
-
-
Method Details
-
addExtSource
public void addExtSource(PerunSession sess, Vo vo, ExtSource source) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerBl
Associate external source definition with the VO.- Specified by:
addExtSource
in interfaceExtSourcesManagerBl
- Parameters:
sess
-vo
-source
-- Throws:
ExtSourceAlreadyAssignedException
-
addExtSource
public void addExtSource(PerunSession sess, Group group, ExtSource source) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerBl
Associate external source definition with the GROUP.- Specified by:
addExtSource
in interfaceExtSourcesManagerBl
- Parameters:
sess
-group
-source
-- Throws:
ExtSourceAlreadyAssignedException
-
addExtSources
public void addExtSources(PerunSession perunSession, Vo vo, List<ExtSource> sources) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerBl
Associate external source definitions with the VO.- Specified by:
addExtSources
in interfaceExtSourcesManagerBl
- Parameters:
perunSession
- sessvo
- vosources
- list of sources to associate- Throws:
ExtSourceAlreadyAssignedException
-
addExtSources
public void addExtSources(PerunSession perunSession, Group group, List<ExtSource> sources) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerBl
Associate external source definitions with the GROUP.- Specified by:
addExtSources
in interfaceExtSourcesManagerBl
- Parameters:
perunSession
- sessgroup
- groupsources
- list of sources to associate- Throws:
ExtSourceAlreadyAssignedException
-
checkExtSourceAssignedToVo
public void checkExtSourceAssignedToVo(PerunSession sess, ExtSource extSource, int voId) throws ExtSourceNotAssignedException, VoNotExistsException Description copied from interface:ExtSourcesManagerBl
Check if extSource is assigned to vo or not. Throw exception if not.- Specified by:
checkExtSourceAssignedToVo
in interfaceExtSourcesManagerBl
- Parameters:
sess
-extSource
-voId
-- Throws:
ExtSourceNotAssignedException
VoNotExistsException
-
checkExtSourceExists
public void checkExtSourceExists(PerunSession sess, ExtSource extSource) throws InternalErrorException, ExtSourceNotExistsException - Specified by:
checkExtSourceExists
in interfaceExtSourcesManagerBl
- Throws:
InternalErrorException
ExtSourceNotExistsException
-
checkOrCreateExtSource
public ExtSource checkOrCreateExtSource(PerunSession sess, String extSourceName, String extSourceType) Description copied from interface:ExtSourcesManagerBl
Checks whether the ExtSource exists, if not, then the ExtSource is created.- Specified by:
checkOrCreateExtSource
in interfaceExtSourcesManagerBl
- Parameters:
sess
-extSourceName
-extSourceType
-- Returns:
- existing or newly created extSource is returned
-
createExtSource
public ExtSource createExtSource(PerunSession sess, ExtSource extSource, Map<String, String> attributes) throws ExtSourceExistsExceptionDescription copied from interface:ExtSourcesManagerBl
Creates an external source.- Specified by:
createExtSource
in interfaceExtSourcesManagerBl
- Parameters:
sess
-extSource
-attributes
-- Returns:
- ExtSource object with newly associated ID.
- Throws:
ExtSourceExistsException
-
deleteExtSource
public void deleteExtSource(PerunSession sess, ExtSource extSource) throws ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerBl
Deletes an external source.- Specified by:
deleteExtSource
in interfaceExtSourcesManagerBl
- Parameters:
sess
-extSource
-- Throws:
ExtSourceAlreadyRemovedException
- if there are 0 rows affected by delete in DB
-
destroy
public void destroy()Description copied from interface:ExtSourcesManagerBl
Destroy manager. Clean resources.- Specified by:
destroy
in interfaceExtSourcesManagerBl
-
generateCandidateGroup
public CandidateGroup generateCandidateGroup(PerunSession perunSession, Map<String, String> groupSubjectData, ExtSource source, String loginPrefix) Description copied from interface:ExtSourcesManagerBl
Generate a candidate group from a group subject data.IMPORTANT: expected, that these subjectData was get from the ExtSource before using.
- Specified by:
generateCandidateGroup
in interfaceExtSourcesManagerBl
- Parameters:
perunSession
-groupSubjectData
-source
-loginPrefix
- login prefix to change group login and parent group login by it- Returns:
- Candidate group object
-
generateCandidateGroups
public List<CandidateGroup> generateCandidateGroups(PerunSession perunSession, List<Map<String, String>> subjectsData, ExtSource source, String loginPrefix) Description copied from interface:ExtSourcesManagerBl
Generate candidate groups from a group subject data.IMPORTANT: expected, that these subjectData was get from the ExtSource before using.
- Specified by:
generateCandidateGroups
in interfaceExtSourcesManagerBl
- Parameters:
perunSession
-subjectsData
-source
-loginPrefix
- login prefix to change group login and parent group login by it- Returns:
- Candidate group objects
-
getAttributes
Description copied from interface:ExtSourcesManagerBl
Gets attributes for external source.- Specified by:
getAttributes
in interfaceExtSourcesManagerBl
- Parameters:
extSource
- External Source- Returns:
- Map of attributes for external source
-
getCandidate
public CandidateSync getCandidate(PerunSession sess, ExtSource source, String login) throws CandidateNotExistsException, ExtSourceUnsupportedOperationException Description copied from interface:ExtSourcesManagerBl
Get the candidate from the ExtSource. Login of the candidate will be used to gain data from the ExtSource.- Specified by:
getCandidate
in interfaceExtSourcesManagerBl
- Parameters:
sess
- Perun sessionsource
- External source which will be used to get data about the candidatelogin
- Login of the candidate- Returns:
- a Candidate object
- Throws:
CandidateNotExistsException
ExtSourceUnsupportedOperationException
-
getCandidate
public CandidateSync getCandidate(PerunSession perunSession, Map<String, String> subjectData, ExtSource source, String login) Description copied from interface:ExtSourcesManagerBl
Get the candidate from subjectData where at least login must exists.IMPORTANT: expected, that these subjectData was get from the ExtSource before using.
- Specified by:
getCandidate
in interfaceExtSourcesManagerBl
- Parameters:
perunSession
- Perun sessionsubjectData
-source
- External source which will be used to get data about the candidatelogin
- Login of the candidate- Returns:
- a Candidate object
-
getDataSource
Description copied from interface:ExtSourcesManagerBl
Returns a database connection pool.- Specified by:
getDataSource
in interfaceExtSourcesManagerBl
- Parameters:
poolName
- named defined in perun-extSources.xml- Returns:
- database connection pool
-
getExtSourceById
public ExtSource getExtSourceById(PerunSession sess, int id) throws InternalErrorException, ExtSourceNotExistsException Description copied from interface:ExtSourcesManagerBl
Searches for the external source with specified id.- Specified by:
getExtSourceById
in interfaceExtSourcesManagerBl
- Parameters:
sess
-id
-- Returns:
- External source with specified id
- Throws:
InternalErrorException
ExtSourceNotExistsException
-
getExtSourceByName
public ExtSource getExtSourceByName(PerunSession sess, String name) throws InternalErrorException, ExtSourceNotExistsException Description copied from interface:ExtSourcesManagerBl
Searches for the external source using specified name.- Specified by:
getExtSourceByName
in interfaceExtSourcesManagerBl
- Parameters:
sess
-name
-- Returns:
- External source with specified name
- Throws:
InternalErrorException
ExtSourceNotExistsException
-
getExtSources
Description copied from interface:ExtSourcesManagerBl
Get list of all external sources.- Specified by:
getExtSources
in interfaceExtSourcesManagerBl
- Parameters:
sess
-- Returns:
- list of external source
- Throws:
InternalErrorException
-
getExtSourcesManagerImpl
Gets the extSourcesManagerImpl for this instance.- Returns:
- extSourceManagerImpl
-
getGroupExtSources
public List<ExtSource> getGroupExtSources(PerunSession sess, Group group) throws InternalErrorException Description copied from interface:ExtSourcesManagerBl
Get list of external sources associated with the GROUP.- Specified by:
getGroupExtSources
in interfaceExtSourcesManagerBl
- Parameters:
sess
-group
-- Returns:
- list of external sources associated with the VO
- Throws:
InternalErrorException
-
getInvalidUsers
Description copied from interface:ExtSourcesManagerBl
Returns list of users stored by this ExtSource, which are not valid.- Specified by:
getInvalidUsers
in interfaceExtSourcesManagerBl
- Parameters:
sess
-source
-- Returns:
- list of users, who is not in the extSource anymore
-
getPerunBl
-
getVoExtSources
Description copied from interface:ExtSourcesManagerBl
Get list of external sources associated with the VO.- Specified by:
getVoExtSources
in interfaceExtSourcesManagerBl
- Parameters:
sess
-vo
-- Returns:
- list of external sources associated with the VO
- Throws:
InternalErrorException
-
initialize
Description copied from interface:ExtSourcesManagerBl
Initialize manager.- Specified by:
initialize
in interfaceExtSourcesManagerBl
-
loadExtSourcesDefinitions
Description copied from interface:ExtSourcesManagerBl
Loads ext source definitions from the configuration file and updates entries stored in the DB.- Specified by:
loadExtSourcesDefinitions
in interfaceExtSourcesManagerBl
- Parameters:
sess
-
-
removeExtSource
public void removeExtSource(PerunSession sess, Vo vo, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerBl
Remove association of the external source from the VO.- Specified by:
removeExtSource
in interfaceExtSourcesManagerBl
- Parameters:
sess
-vo
-source
-- Throws:
ExtSourceNotAssignedException
ExtSourceAlreadyRemovedException
- if there are 0 rows affected by delete from DB
-
removeExtSource
public void removeExtSource(PerunSession sess, Group group, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerBl
Remove association of the external source from the GROUP.- Specified by:
removeExtSource
in interfaceExtSourcesManagerBl
- Parameters:
sess
-group
-source
-- Throws:
ExtSourceNotAssignedException
ExtSourceAlreadyRemovedException
- when 0 rows affected by removing from DB
-
removeExtSources
public void removeExtSources(PerunSession sess, Vo vo, List<ExtSource> sources) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerBl
Remove associations of external sources from the VO.- Specified by:
removeExtSources
in interfaceExtSourcesManagerBl
- Parameters:
sess
-vo
-sources
-- Throws:
ExtSourceNotAssignedException
ExtSourceAlreadyRemovedException
- when 0 rows affected by removing from DB
-
removeExtSources
public void removeExtSources(PerunSession sess, Group group, List<ExtSource> sources) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerBl
Remove associations of external sources from the GROUP.- Specified by:
removeExtSources
in interfaceExtSourcesManagerBl
- Parameters:
sess
-group
-sources
-- Throws:
ExtSourceNotAssignedException
ExtSourceAlreadyRemovedException
- when 0 rows affected by removing from DB
-
setPerunBl
-