Package cz.metacentrum.perun.core.impl
Class ExtSourcesManagerImpl
java.lang.Object
cz.metacentrum.perun.core.impl.ExtSourcesManagerImpl
- All Implemented Interfaces:
ExtSourcesManagerImplApi
-
Field Summary
-
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
checkExtSourceExists
(PerunSession perunSession, ExtSource es) Check if extSource exists in underlaying data source.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()
Cleans up allocated resources.boolean
extSourceExists
(PerunSession perunSession, ExtSource extSource) Check if extSource exists in underlaying data source.getAssociatedUsersIdsWithExtSource
(PerunSession sess, ExtSource source) Get all users' id associate with the provided ExtSourcegetAttributes
(ExtSource extSource) Gets attributes for external source.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.Returns all ExtSources with enabled synchronizationgetGroupExtSourcesIds
(PerunSession perunSession, Group group) Get list of external sources ids associated with the GROUP.getVoExtSourcesIds
(PerunSession sess, Vo vo) Get list of external sources ids associated to the VO.void
initialize
(PerunSession sess, PerunBl perunBl) Routine which initialize the extSourcesManager.void
Loads the extSources definitions from the XML configuration file.void
removeExtSource
(PerunSession perunSession, 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
void
updateExtSource
(PerunSession sess, ExtSource extSource, Map<String, String> attributes) Updates extSource definition.
-
Field Details
-
USEREXTSOURCEMAPPING
- See Also:
-
-
Constructor Details
-
ExtSourcesManagerImpl
-
-
Method Details
-
addExtSource
public void addExtSource(PerunSession sess, Vo vo, ExtSource source) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerImplApi
Associate external source definition with the VO.- Specified by:
addExtSource
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-vo
-source
-- Throws:
ExtSourceAlreadyAssignedException
-
addExtSource
public void addExtSource(PerunSession sess, Group group, ExtSource source) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerImplApi
Associate external source definition with the GROUP.- Specified by:
addExtSource
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-group
-source
-- Throws:
ExtSourceAlreadyAssignedException
-
checkExtSourceExists
public void checkExtSourceExists(PerunSession perunSession, ExtSource es) throws ExtSourceNotExistsException Description copied from interface:ExtSourcesManagerImplApi
Check if extSource exists in underlaying data source.- Specified by:
checkExtSourceExists
in interfaceExtSourcesManagerImplApi
- Parameters:
perunSession
-es
-- Throws:
ExtSourceNotExistsException
-
createExtSource
public ExtSource createExtSource(PerunSession sess, ExtSource extSource, Map<String, String> attributes) throws ExtSourceExistsExceptionDescription copied from interface:ExtSourcesManagerImplApi
Creates an external source.- Specified by:
createExtSource
in interfaceExtSourcesManagerImplApi
- 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:ExtSourcesManagerImplApi
Deletes an external source.- Specified by:
deleteExtSource
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-extSource
-- Throws:
ExtSourceAlreadyRemovedException
- if there are 0 rows affected by delete in DB
-
destroy
public void destroy()Cleans up allocated resources.- Specified by:
destroy
in interfaceExtSourcesManagerImplApi
-
extSourceExists
Description copied from interface:ExtSourcesManagerImplApi
Check if extSource exists in underlaying data source.- Specified by:
extSourceExists
in interfaceExtSourcesManagerImplApi
- Parameters:
perunSession
-extSource
-- Returns:
- true if extSource exists in underlaying data source, false otherwise
-
getAssociatedUsersIdsWithExtSource
Description copied from interface:ExtSourcesManagerImplApi
Get all users' id associate with the provided ExtSource- Specified by:
getAssociatedUsersIdsWithExtSource
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-source
-- Returns:
- list of users' id associated with the provided ExtSource
-
getAttributes
Description copied from interface:ExtSourcesManagerImplApi
Gets attributes for external source.- Specified by:
getAttributes
in interfaceExtSourcesManagerImplApi
- Parameters:
extSource
- External Source- Returns:
- Map of attributes for external source
-
getDataSource
Description copied from interface:ExtSourcesManagerImplApi
Returns a database connection pool.- Specified by:
getDataSource
in interfaceExtSourcesManagerImplApi
- Parameters:
poolName
- named defined in perun-extSources.xml- Returns:
- database connection pool
-
getExtSourceById
Description copied from interface:ExtSourcesManagerImplApi
Searches for the external source with specified id.- Specified by:
getExtSourceById
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-id
-- Returns:
- External source with specified id
- Throws:
ExtSourceNotExistsException
-
getExtSourceByName
public ExtSource getExtSourceByName(PerunSession sess, String name) throws ExtSourceNotExistsException Description copied from interface:ExtSourcesManagerImplApi
Searches for the external source using specified name.- Specified by:
getExtSourceByName
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-name
-- Returns:
- External source with specified name
- Throws:
ExtSourceNotExistsException
-
getExtSources
Description copied from interface:ExtSourcesManagerImplApi
Get list of all external sources.- Specified by:
getExtSources
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-- Returns:
- list of VO
-
getExtSourcesToSynchronize
Description copied from interface:ExtSourcesManagerImplApi
Returns all ExtSources with enabled synchronization- Specified by:
getExtSourcesToSynchronize
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
- PerunSession- Returns:
- List of External Sources with enabled synchronization
-
getGroupExtSourcesIds
public List<Integer> getGroupExtSourcesIds(PerunSession perunSession, Group group) throws InternalErrorException Description copied from interface:ExtSourcesManagerImplApi
Get list of external sources ids associated with the GROUP.- Specified by:
getGroupExtSourcesIds
in interfaceExtSourcesManagerImplApi
- Parameters:
perunSession
-group
-- Returns:
- list of external sources ids associated with the group
- Throws:
InternalErrorException
-
getVoExtSourcesIds
Description copied from interface:ExtSourcesManagerImplApi
Get list of external sources ids associated to the VO.- Specified by:
getVoExtSourcesIds
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-vo
-- Returns:
- list of external sources ids associated with the VO
- Throws:
InternalErrorException
-
initialize
Routine which initialize the extSourcesManager.- Specified by:
initialize
in interfaceExtSourcesManagerImplApi
-
loadExtSourcesDefinitions
Loads the extSources definitions from the XML configuration file. All data from the extSouces XML file are synchronized with the DB.Example:
MAIN PEOPLEDB jdbc:oracle:thin:@//oracle.example.com:1521/people perun ****** oracle.jdbc.OracleDriver 300000 600000 10 1 300000 30000 INET cz.metacentrum.perun.core.impl.ExtSourceSql INETDB ... ... - Specified by:
loadExtSourcesDefinitions
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-
-
removeExtSource
public void removeExtSource(PerunSession sess, Vo vo, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerImplApi
Remove association of the external source from the VO.- Specified by:
removeExtSource
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-vo
-source
-- Throws:
ExtSourceNotAssignedException
ExtSourceAlreadyRemovedException
- if there are 0 rows affected by remove in DB
-
removeExtSource
public void removeExtSource(PerunSession perunSession, Group group, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerImplApi
Remove association of the external source from the GROUP.- Specified by:
removeExtSource
in interfaceExtSourcesManagerImplApi
- Parameters:
perunSession
-group
-source
-- Throws:
ExtSourceNotAssignedException
ExtSourceAlreadyRemovedException
- when 0 rows affected by removing from DB
-
setSelf
-
updateExtSource
public void updateExtSource(PerunSession sess, ExtSource extSource, Map<String, String> attributes) throws ExtSourceNotExistsExceptionDescription copied from interface:ExtSourcesManagerImplApi
Updates extSource definition. It should be called only internally, because extSources are defined in the external XML file. It shouldn't be called from upper layers !!!- Specified by:
updateExtSource
in interfaceExtSourcesManagerImplApi
- Parameters:
sess
-extSource
-- Throws:
ExtSourceNotExistsException
-