Package cz.metacentrum.perun.core.blImpl
Class ExtSourcesManagerBlImpl
java.lang.Object
cz.metacentrum.perun.core.blImpl.ExtSourcesManagerBlImpl
- All Implemented Interfaces:
ExtSourcesManagerBl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtSource(PerunSession sess, Group group, ExtSource source) Associate external source definition with the GROUP.voidaddExtSource(PerunSession sess, Vo vo, ExtSource source) Associate external source definition with the VO.voidaddExtSources(PerunSession perunSession, Group group, List<ExtSource> sources) Associate external source definitions with the GROUP.voidaddExtSources(PerunSession perunSession, Vo vo, List<ExtSource> sources) Associate external source definitions with the VO.voidcheckExtSourceAssignedToVo(PerunSession sess, ExtSource extSource, int voId) Check if extSource is assigned to vo or not.voidcheckExtSourceExists(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.voiddeleteExtSource(PerunSession sess, ExtSource extSource) Deletes an external source.voiddestroy()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.voidinitialize(PerunSession sess) Initialize manager.voidLoads ext source definitions from the configuration file and updates entries stored in the DB.voidremoveExtSource(PerunSession sess, Group group, ExtSource source) Remove association of the external source from the GROUP.voidremoveExtSource(PerunSession sess, Vo vo, ExtSource source) Remove association of the external source from the VO.voidremoveExtSources(PerunSession sess, Group group, List<ExtSource> sources) Remove associations of external sources from the GROUP.voidremoveExtSources(PerunSession sess, Vo vo, List<ExtSource> sources) Remove associations of external sources from the VO.voidsetPerunBl(PerunBl perunBl)
-
Constructor Details
-
ExtSourcesManagerBlImpl
-
-
Method Details
-
addExtSource
public void addExtSource(PerunSession sess, Vo vo, ExtSource source) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerBlAssociate external source definition with the VO.- Specified by:
addExtSourcein interfaceExtSourcesManagerBl- Parameters:
sess-vo-source-- Throws:
ExtSourceAlreadyAssignedException
-
addExtSource
public void addExtSource(PerunSession sess, Group group, ExtSource source) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerBlAssociate external source definition with the GROUP.- Specified by:
addExtSourcein interfaceExtSourcesManagerBl- Parameters:
sess-group-source-- Throws:
ExtSourceAlreadyAssignedException
-
addExtSources
public void addExtSources(PerunSession perunSession, Vo vo, List<ExtSource> sources) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerBlAssociate external source definitions with the VO.- Specified by:
addExtSourcesin 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:ExtSourcesManagerBlAssociate external source definitions with the GROUP.- Specified by:
addExtSourcesin 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:ExtSourcesManagerBlCheck if extSource is assigned to vo or not. Throw exception if not.- Specified by:
checkExtSourceAssignedToVoin interfaceExtSourcesManagerBl- Parameters:
sess-extSource-voId-- Throws:
ExtSourceNotAssignedExceptionVoNotExistsException
-
checkExtSourceExists
public void checkExtSourceExists(PerunSession sess, ExtSource extSource) throws InternalErrorException, ExtSourceNotExistsException - Specified by:
checkExtSourceExistsin interfaceExtSourcesManagerBl- Throws:
InternalErrorExceptionExtSourceNotExistsException
-
checkOrCreateExtSource
public ExtSource checkOrCreateExtSource(PerunSession sess, String extSourceName, String extSourceType) Description copied from interface:ExtSourcesManagerBlChecks whether the ExtSource exists, if not, then the ExtSource is created.- Specified by:
checkOrCreateExtSourcein 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:ExtSourcesManagerBlCreates an external source.- Specified by:
createExtSourcein 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:ExtSourcesManagerBlDeletes an external source.- Specified by:
deleteExtSourcein interfaceExtSourcesManagerBl- Parameters:
sess-extSource-- Throws:
ExtSourceAlreadyRemovedException- if there are 0 rows affected by delete in DB
-
destroy
public void destroy()Description copied from interface:ExtSourcesManagerBlDestroy manager. Clean resources.- Specified by:
destroyin interfaceExtSourcesManagerBl
-
generateCandidateGroup
public CandidateGroup generateCandidateGroup(PerunSession perunSession, Map<String, String> groupSubjectData, ExtSource source, String loginPrefix) Description copied from interface:ExtSourcesManagerBlGenerate a candidate group from a group subject data.IMPORTANT: expected, that these subjectData was get from the ExtSource before using.
- Specified by:
generateCandidateGroupin 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:ExtSourcesManagerBlGenerate candidate groups from a group subject data.IMPORTANT: expected, that these subjectData was get from the ExtSource before using.
- Specified by:
generateCandidateGroupsin 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:ExtSourcesManagerBlGets attributes for external source.- Specified by:
getAttributesin 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:ExtSourcesManagerBlGet the candidate from the ExtSource. Login of the candidate will be used to gain data from the ExtSource.- Specified by:
getCandidatein 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:
CandidateNotExistsExceptionExtSourceUnsupportedOperationException
-
getCandidate
public CandidateSync getCandidate(PerunSession perunSession, Map<String, String> subjectData, ExtSource source, String login) Description copied from interface:ExtSourcesManagerBlGet the candidate from subjectData where at least login must exists.IMPORTANT: expected, that these subjectData was get from the ExtSource before using.
- Specified by:
getCandidatein 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:ExtSourcesManagerBlReturns a database connection pool.- Specified by:
getDataSourcein 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:ExtSourcesManagerBlSearches for the external source with specified id.- Specified by:
getExtSourceByIdin interfaceExtSourcesManagerBl- Parameters:
sess-id-- Returns:
- External source with specified id
- Throws:
InternalErrorExceptionExtSourceNotExistsException
-
getExtSourceByName
public ExtSource getExtSourceByName(PerunSession sess, String name) throws InternalErrorException, ExtSourceNotExistsException Description copied from interface:ExtSourcesManagerBlSearches for the external source using specified name.- Specified by:
getExtSourceByNamein interfaceExtSourcesManagerBl- Parameters:
sess-name-- Returns:
- External source with specified name
- Throws:
InternalErrorExceptionExtSourceNotExistsException
-
getExtSources
Description copied from interface:ExtSourcesManagerBlGet list of all external sources.- Specified by:
getExtSourcesin 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:ExtSourcesManagerBlGet list of external sources associated with the GROUP.- Specified by:
getGroupExtSourcesin interfaceExtSourcesManagerBl- Parameters:
sess-group-- Returns:
- list of external sources associated with the VO
- Throws:
InternalErrorException
-
getInvalidUsers
Description copied from interface:ExtSourcesManagerBlReturns list of users stored by this ExtSource, which are not valid.- Specified by:
getInvalidUsersin interfaceExtSourcesManagerBl- Parameters:
sess-source-- Returns:
- list of users, who is not in the extSource anymore
-
getPerunBl
-
getVoExtSources
Description copied from interface:ExtSourcesManagerBlGet list of external sources associated with the VO.- Specified by:
getVoExtSourcesin interfaceExtSourcesManagerBl- Parameters:
sess-vo-- Returns:
- list of external sources associated with the VO
- Throws:
InternalErrorException
-
initialize
Description copied from interface:ExtSourcesManagerBlInitialize manager.- Specified by:
initializein interfaceExtSourcesManagerBl
-
loadExtSourcesDefinitions
Description copied from interface:ExtSourcesManagerBlLoads ext source definitions from the configuration file and updates entries stored in the DB.- Specified by:
loadExtSourcesDefinitionsin interfaceExtSourcesManagerBl- Parameters:
sess-
-
removeExtSource
public void removeExtSource(PerunSession sess, Vo vo, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerBlRemove association of the external source from the VO.- Specified by:
removeExtSourcein interfaceExtSourcesManagerBl- Parameters:
sess-vo-source-- Throws:
ExtSourceNotAssignedExceptionExtSourceAlreadyRemovedException- 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:ExtSourcesManagerBlRemove association of the external source from the GROUP.- Specified by:
removeExtSourcein interfaceExtSourcesManagerBl- Parameters:
sess-group-source-- Throws:
ExtSourceNotAssignedExceptionExtSourceAlreadyRemovedException- 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:ExtSourcesManagerBlRemove associations of external sources from the VO.- Specified by:
removeExtSourcesin interfaceExtSourcesManagerBl- Parameters:
sess-vo-sources-- Throws:
ExtSourceNotAssignedExceptionExtSourceAlreadyRemovedException- 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:ExtSourcesManagerBlRemove associations of external sources from the GROUP.- Specified by:
removeExtSourcesin interfaceExtSourcesManagerBl- Parameters:
sess-group-sources-- Throws:
ExtSourceNotAssignedExceptionExtSourceAlreadyRemovedException- when 0 rows affected by removing from DB
-
setPerunBl
-