Package cz.metacentrum.perun.core.impl
Class ExtSourcesManagerImpl
java.lang.Object
cz.metacentrum.perun.core.impl.ExtSourcesManagerImpl
- All Implemented Interfaces:
ExtSourcesManagerImplApi
-
Field Summary
Fields -
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.voidcheckExtSourceExists(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.voiddeleteExtSource(PerunSession sess, ExtSource extSource) Deletes an external source.voiddestroy()Cleans up allocated resources.booleanextSourceExists(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.voidinitialize(PerunSession sess, PerunBl perunBl) Routine which initialize the extSourcesManager.voidLoads the extSources definitions from the XML configuration file.voidremoveExtSource(PerunSession perunSession, 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.voidvoidupdateExtSource(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:ExtSourcesManagerImplApiAssociate external source definition with the VO.- Specified by:
addExtSourcein interfaceExtSourcesManagerImplApi- Parameters:
sess-vo-source-- Throws:
ExtSourceAlreadyAssignedException
-
addExtSource
public void addExtSource(PerunSession sess, Group group, ExtSource source) throws ExtSourceAlreadyAssignedException Description copied from interface:ExtSourcesManagerImplApiAssociate external source definition with the GROUP.- Specified by:
addExtSourcein interfaceExtSourcesManagerImplApi- Parameters:
sess-group-source-- Throws:
ExtSourceAlreadyAssignedException
-
checkExtSourceExists
public void checkExtSourceExists(PerunSession perunSession, ExtSource es) throws ExtSourceNotExistsException Description copied from interface:ExtSourcesManagerImplApiCheck if extSource exists in underlaying data source.- Specified by:
checkExtSourceExistsin interfaceExtSourcesManagerImplApi- Parameters:
perunSession-es-- Throws:
ExtSourceNotExistsException
-
createExtSource
public ExtSource createExtSource(PerunSession sess, ExtSource extSource, Map<String, String> attributes) throws ExtSourceExistsExceptionDescription copied from interface:ExtSourcesManagerImplApiCreates an external source.- Specified by:
createExtSourcein 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:ExtSourcesManagerImplApiDeletes an external source.- Specified by:
deleteExtSourcein 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:
destroyin interfaceExtSourcesManagerImplApi
-
extSourceExists
Description copied from interface:ExtSourcesManagerImplApiCheck if extSource exists in underlaying data source.- Specified by:
extSourceExistsin interfaceExtSourcesManagerImplApi- Parameters:
perunSession-extSource-- Returns:
- true if extSource exists in underlaying data source, false otherwise
-
getAssociatedUsersIdsWithExtSource
Description copied from interface:ExtSourcesManagerImplApiGet all users' id associate with the provided ExtSource- Specified by:
getAssociatedUsersIdsWithExtSourcein interfaceExtSourcesManagerImplApi- Parameters:
sess-source-- Returns:
- list of users' id associated with the provided ExtSource
-
getAttributes
Description copied from interface:ExtSourcesManagerImplApiGets attributes for external source.- Specified by:
getAttributesin interfaceExtSourcesManagerImplApi- Parameters:
extSource- External Source- Returns:
- Map of attributes for external source
-
getDataSource
Description copied from interface:ExtSourcesManagerImplApiReturns a database connection pool.- Specified by:
getDataSourcein interfaceExtSourcesManagerImplApi- Parameters:
poolName- named defined in perun-extSources.xml- Returns:
- database connection pool
-
getExtSourceById
Description copied from interface:ExtSourcesManagerImplApiSearches for the external source with specified id.- Specified by:
getExtSourceByIdin 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:ExtSourcesManagerImplApiSearches for the external source using specified name.- Specified by:
getExtSourceByNamein interfaceExtSourcesManagerImplApi- Parameters:
sess-name-- Returns:
- External source with specified name
- Throws:
ExtSourceNotExistsException
-
getExtSources
Description copied from interface:ExtSourcesManagerImplApiGet list of all external sources.- Specified by:
getExtSourcesin interfaceExtSourcesManagerImplApi- Parameters:
sess-- Returns:
- list of VO
-
getExtSourcesToSynchronize
Description copied from interface:ExtSourcesManagerImplApiReturns all ExtSources with enabled synchronization- Specified by:
getExtSourcesToSynchronizein 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:ExtSourcesManagerImplApiGet list of external sources ids associated with the GROUP.- Specified by:
getGroupExtSourcesIdsin interfaceExtSourcesManagerImplApi- Parameters:
perunSession-group-- Returns:
- list of external sources ids associated with the group
- Throws:
InternalErrorException
-
getVoExtSourcesIds
Description copied from interface:ExtSourcesManagerImplApiGet list of external sources ids associated to the VO.- Specified by:
getVoExtSourcesIdsin interfaceExtSourcesManagerImplApi- Parameters:
sess-vo-- Returns:
- list of external sources ids associated with the VO
- Throws:
InternalErrorException
-
initialize
Routine which initialize the extSourcesManager.- Specified by:
initializein 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:
loadExtSourcesDefinitionsin interfaceExtSourcesManagerImplApi- Parameters:
sess-
-
removeExtSource
public void removeExtSource(PerunSession sess, Vo vo, ExtSource source) throws ExtSourceNotAssignedException, ExtSourceAlreadyRemovedException Description copied from interface:ExtSourcesManagerImplApiRemove association of the external source from the VO.- Specified by:
removeExtSourcein interfaceExtSourcesManagerImplApi- Parameters:
sess-vo-source-- Throws:
ExtSourceNotAssignedExceptionExtSourceAlreadyRemovedException- 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:ExtSourcesManagerImplApiRemove association of the external source from the GROUP.- Specified by:
removeExtSourcein interfaceExtSourcesManagerImplApi- Parameters:
perunSession-group-source-- Throws:
ExtSourceNotAssignedExceptionExtSourceAlreadyRemovedException- 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:ExtSourcesManagerImplApiUpdates 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:
updateExtSourcein interfaceExtSourcesManagerImplApi- Parameters:
sess-extSource-- Throws:
ExtSourceNotExistsException
-