Package cz.metacentrum.perun.core.impl
Class ServicesManagerImpl
java.lang.Object
cz.metacentrum.perun.core.impl.ServicesManagerImpl
- All Implemented Interfaces:
ServicesManagerImplApi
- Author:
- Michal Prochazka invalid input: '<'michalp@ics.muni.cz>, Slavek Licehammer invalid input: '<'glory@ics.muni.cz>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RowMapper<Destination> static final Stringstatic final Stringstatic final RowMapper<RichDestination> static final Stringstatic final Stringstatic final RowMapper<ServiceDenial> static final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDestination(PerunSession sess, Service service, Facility facility, Destination destination) Adds an destination for the facility and service.voidaddRequiredAttribute(PerunSession sess, Service service, AttributeDefinition attribute) Mark the attribute as required for the service.voidaddRequiredAttributes(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) Batch version of addRequiredAttributevoidblockServiceOnDestination(PerunSession sess, int serviceId, int destinationId) Block Service on specific Destination.voidblockServiceOnFacility(PerunSession sess, int serviceId, int facilityId) Block Service on Facility.voidcheckServiceExists(PerunSession sess, Service service) Check if service exists in underlaying data source.createDestination(PerunSession sess, Destination destination) createService(PerunSession sess, Service service) Creates new service.voiddeleteDestination(PerunSession sess, Destination destination) Deletes destination.voiddeleteService(PerunSession sess, Service service) Deletes the service.booleandestinationExists(PerunSession sess, Destination destination) booleandestinationExists(PerunSession sess, Service service, Facility facility, Destination destination) Determine if destination exists for specified facility and service.getAllRichDestinations(PerunSession perunSession, Facility facility) Get list of all rich destinations defined for the facility.getAllRichDestinations(PerunSession perunSession, Service service) Get list of all rich destinations defined for the service.getAssignedResources(PerunSession sess, Service service) Get all resources which use this service.getAssignedServices(PerunSession perunSession, Facility facility) List all services associated with the facility (via resource).getAssignedServices(PerunSession perunSession, Facility facility, Vo vo) List all services associated with the facility and vo (via resource).getDestination(PerunSession sess, String destination, String type) Get destination by String destination and typegetDestinationById(PerunSession sess, int id) Get destination by idgetDestinations(PerunSession perunSession) Get list of all destinations.getDestinations(PerunSession perunSession, Facility facility) Get lists of all destinations for specific FacilitygetDestinations(PerunSession sess, Service service, Facility facility) Get list of all destinations defined for the service and facility.intGet count of all destinations.getFacilitiesDestinations(PerunSession sess, Vo vo) List all destinations for all facilities which are joined by resources to the VO.getRichDestinations(PerunSession perunSession, Facility facility, Service service) Get list of all rich destinations defined for the service and the facilitygetServiceById(PerunSession sess, int id) Get service by id.getServiceByName(PerunSession sess, String name) Get service by name.getServices(PerunSession sess) get all services in perungetServicesBlockedOnDestination(int destinationId) Get Services blocked on Destination.getServicesBlockedOnFacility(int facilityId) Get Services blocked on Facility.getServicesByAttributeDefinition(PerunSession sess, AttributeDefinition attributeDefinition) Get all services with given attribute.getServicesFromDestination(int destinationId) Return list of services this destination points to.booleanisServiceAssignedToFacility(PerunSession sess, Facility facility, Service service) Checks whether given service is assigned to given facility (through some resource).booleanisServiceBlockedOnDestination(int serviceId, int destinationId) Return TRUE if Service is blocked on Destination.booleanisServiceBlockedOnFacility(int serviceId, int facilityId) Return TRUE if Service is blocked on Facility.voidremoveAllDestinations(PerunSession sess, Facility facility) Removes all defined destinations for the facility.voidremoveAllDestinations(PerunSession sess, Service service, Facility facility) Removes all defined destinations for the service and facility.voidremoveAllRequiredAttributes(PerunSession sess, Service service) Detate all required attributes from servicevoidremoveDestination(PerunSession sess, Service service, Facility facility, Destination destination) Removes an destination from the facility and service.voidremoveRequiredAttribute(PerunSession sess, Service service, AttributeDefinition attribute) Remove required attribute from service.voidremoveRequiredAttributes(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) Batch version of removeRequiredAttributebooleanserviceExists(PerunSession sess, Service service) Check if service exists in underlaying data source.voidunblockAllServicesOnDestination(int destinationId) Unblock all blocked Services on specified Destination.voidunblockAllServicesOnFacility(int facilityId) Unblock all blocked Services on Facility.voidunblockService(int serviceId) Unblock Service everywhere.voidunblockServiceOnDestination(int serviceId, int destinationId) Unblock Service on specific Destination.voidunblockServiceOnFacility(int serviceId, int facilityId) Unblock Service on whole Facility.voidupdateService(PerunSession sess, Service service) Updates the service.
-
Field Details
-
SERVICE_MAPPING_SELECT_QUERY
- See Also:
-
SERVICE_DENIAL_MAPPING_SELECT_QUERY
- See Also:
-
DESTINATION_MAPPING_SELECT_QUERY
- See Also:
-
FACILITY_DESTINATION_MAPPING_SELECT_QUERY
- See Also:
-
RICH_DESTINATION_MAPPING_SELECT_QUERY
- See Also:
-
RICH_DESTINATION_WITH_LAST_PROPAGATION_MAPPING_SELECT_QUERY
- See Also:
-
SERVICE_MAPPER
-
SERVICE_DENIAL_MAPPER
-
DESTINATION_MAPPER
-
RICH_DESTINATION_MAPPER
-
-
Constructor Details
-
ServicesManagerImpl
-
-
Method Details
-
addDestination
public void addDestination(PerunSession sess, Service service, Facility facility, Destination destination) throws DestinationAlreadyAssignedException Description copied from interface:ServicesManagerImplApiAdds an destination for the facility and service.- Specified by:
addDestinationin interfaceServicesManagerImplApi- Parameters:
sess-service-facility-destination- string contains destination address (mail, url, hostname, ...)- Throws:
DestinationAlreadyAssignedException- when the combination already exists
-
addRequiredAttribute
public void addRequiredAttribute(PerunSession sess, Service service, AttributeDefinition attribute) throws AttributeAlreadyAssignedException Description copied from interface:ServicesManagerImplApiMark the attribute as required for the service. Required attribues are requisite for Service to run. If you add attribute which has a default attribute then this default attribute will be automatically add too.- Specified by:
addRequiredAttributein interfaceServicesManagerImplApi- Parameters:
sess- perunSessionservice- service to which the attribute will be addedattribute- attribute to add- Throws:
AttributeAlreadyAssignedException- if the attribute is already added
-
addRequiredAttributes
public void addRequiredAttributes(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) throws AttributeAlreadyAssignedException Description copied from interface:ServicesManagerImplApiBatch version of addRequiredAttribute- Specified by:
addRequiredAttributesin interfaceServicesManagerImplApi- Throws:
AttributeAlreadyAssignedException- See Also:
-
blockServiceOnDestination
public void blockServiceOnDestination(PerunSession sess, int serviceId, int destinationId) throws ServiceAlreadyBannedException Description copied from interface:ServicesManagerImplApiBlock Service on specific Destination. Service still can be propagated to other facility Destinations.- Specified by:
blockServiceOnDestinationin interfaceServicesManagerImplApi- Parameters:
sess-serviceId- The Service to be blocked on this particular destinationdestinationId- The destination on which we want to block the Service- Throws:
ServiceAlreadyBannedException
-
blockServiceOnFacility
public void blockServiceOnFacility(PerunSession sess, int serviceId, int facilityId) throws ServiceAlreadyBannedException Description copied from interface:ServicesManagerImplApiBlock Service on Facility. It won't be possible to propagate service on whole facility or any of its destinations.- Specified by:
blockServiceOnFacilityin interfaceServicesManagerImplApi- Parameters:
sess-serviceId- The Service to be blocked on the FacilityfacilityId- The Facility on which we want to block the Service- Throws:
ServiceAlreadyBannedException
-
checkServiceExists
Description copied from interface:ServicesManagerImplApiCheck if service exists in underlaying data source.- Specified by:
checkServiceExistsin interfaceServicesManagerImplApi- Parameters:
sess- perun sessionservice- service to check- Throws:
ServiceNotExistsException- if service doesn't exists
-
createDestination
- Specified by:
createDestinationin interfaceServicesManagerImplApi
-
createService
Description copied from interface:ServicesManagerImplApiCreates new service.- Specified by:
createServicein interfaceServicesManagerImplApi- Parameters:
sess-service-- Returns:
- new service
-
deleteDestination
public void deleteDestination(PerunSession sess, Destination destination) throws DestinationAlreadyRemovedException, RelationExistsException Description copied from interface:ServicesManagerImplApiDeletes destination.- Specified by:
deleteDestinationin interfaceServicesManagerImplApi- Parameters:
sess-destination- destination to be deleted- Throws:
DestinationAlreadyRemovedException- if there are 0 rows affected by deleting from DBRelationExistsException- if the destination has some existing relations in DB
-
deleteService
Description copied from interface:ServicesManagerImplApiDeletes the service.- Specified by:
deleteServicein interfaceServicesManagerImplApi- Parameters:
sess-service-- Throws:
ServiceAlreadyRemovedException- if there are 0 rows affected by deleting from DB
-
destinationExists
public boolean destinationExists(PerunSession sess, Service service, Facility facility, Destination destination) Description copied from interface:ServicesManagerImplApiDetermine if destination exists for specified facility and service.- Specified by:
destinationExistsin interfaceServicesManagerImplApi- Parameters:
sess-service-facility-destination-- Returns:
- true if the destination exists for the facility and the resource
-
destinationExists
- Specified by:
destinationExistsin interfaceServicesManagerImplApi
-
getAllRichDestinations
Description copied from interface:ServicesManagerImplApiGet list of all rich destinations defined for the facility.- Specified by:
getAllRichDestinationsin interfaceServicesManagerImplApi- Parameters:
perunSession-facility-- Returns:
- list of rich destinations defined for the facility
-
getAllRichDestinations
Description copied from interface:ServicesManagerImplApiGet list of all rich destinations defined for the service.- Specified by:
getAllRichDestinationsin interfaceServicesManagerImplApi- Parameters:
perunSession-service-- Returns:
- list of rich destinations defined for the service
-
getAssignedResources
Description copied from interface:ServicesManagerImplApiGet all resources which use this service.- Specified by:
getAssignedResourcesin interfaceServicesManagerImplApi- Parameters:
sess-service-- Returns:
- list of resources
-
getAssignedServices
Description copied from interface:ServicesManagerImplApiList all services associated with the facility (via resource).- Specified by:
getAssignedServicesin interfaceServicesManagerImplApi- Parameters:
perunSession-facility-- Returns:
- list of services assigned to facility
-
getAssignedServices
Description copied from interface:ServicesManagerImplApiList all services associated with the facility and vo (via resource).- Specified by:
getAssignedServicesin interfaceServicesManagerImplApi- Parameters:
perunSession-facility-vo-- Returns:
- list of services assigned to facility and vo
-
getDestination
public Destination getDestination(PerunSession sess, String destination, String type) throws DestinationNotExistsException Description copied from interface:ServicesManagerImplApiGet destination by String destination and type- Specified by:
getDestinationin interfaceServicesManagerImplApi- Parameters:
sess-destination- Destination string representationtype- type of destination- Returns:
- Destination
- Throws:
DestinationNotExistsException
-
getDestinationById
public Destination getDestinationById(PerunSession sess, int id) throws DestinationNotExistsException Description copied from interface:ServicesManagerImplApiGet destination by id- Specified by:
getDestinationByIdin interfaceServicesManagerImplApi- Parameters:
sess-id-- Returns:
- Destination with the id
- Throws:
DestinationNotExistsException
-
getDestinations
Description copied from interface:ServicesManagerImplApiGet list of all destinations defined for the service and facility.- Specified by:
getDestinationsin interfaceServicesManagerImplApi- Parameters:
sess-service-facility-- Returns:
- list list of destinations defined for the service and facility
-
getDestinations
Description copied from interface:ServicesManagerImplApiGet list of all destinations.- Specified by:
getDestinationsin interfaceServicesManagerImplApi- Parameters:
perunSession-- Returns:
- list of all destinations for session
-
getDestinations
Description copied from interface:ServicesManagerImplApiGet lists of all destinations for specific Facility- Specified by:
getDestinationsin interfaceServicesManagerImplApi- Parameters:
perunSession-facility- the facility- Returns:
- lists of all destinations for specific Facility
-
getDestinationsCount
Description copied from interface:ServicesManagerImplApiGet count of all destinations.- Specified by:
getDestinationsCountin interfaceServicesManagerImplApi- Parameters:
sess-- Returns:
- count of all destinations
-
getFacilitiesDestinations
Description copied from interface:ServicesManagerImplApiList all destinations for all facilities which are joined by resources to the VO.- Specified by:
getFacilitiesDestinationsin interfaceServicesManagerImplApi- Parameters:
sess-vo- vo for which we are searching destinations- Returns:
- list of destinations
-
getRichDestinations
public List<RichDestination> getRichDestinations(PerunSession perunSession, Facility facility, Service service) Description copied from interface:ServicesManagerImplApiGet list of all rich destinations defined for the service and the facility- Specified by:
getRichDestinationsin interfaceServicesManagerImplApi- Parameters:
perunSession-facility-service-- Returns:
- list of rich destinations defined for the service and the facility
-
getServiceById
Description copied from interface:ServicesManagerImplApiGet service by id.- Specified by:
getServiceByIdin interfaceServicesManagerImplApi- Parameters:
sess-id-- Returns:
- service with specified id
- Throws:
ServiceNotExistsException
-
getServiceByName
Description copied from interface:ServicesManagerImplApiGet service by name.- Specified by:
getServiceByNamein interfaceServicesManagerImplApi- Parameters:
sess-name- name of the service- Returns:
- service with specified name
- Throws:
ServiceNotExistsException
-
getServices
Description copied from interface:ServicesManagerImplApiget all services in perun- Specified by:
getServicesin interfaceServicesManagerImplApi- Parameters:
sess-- Returns:
- all services in perun
-
getServicesBlockedOnDestination
Description copied from interface:ServicesManagerImplApiGet Services blocked on Destination.- Specified by:
getServicesBlockedOnDestinationin interfaceServicesManagerImplApi- Parameters:
destinationId- ID of Destination to get blocked Services for.- Returns:
- List of blocked Services.
-
getServicesBlockedOnFacility
Description copied from interface:ServicesManagerImplApiGet Services blocked on Facility.- Specified by:
getServicesBlockedOnFacilityin interfaceServicesManagerImplApi- Parameters:
facilityId- ID of Facility to get blocked Services for.- Returns:
- List of blocked Services.
-
getServicesByAttributeDefinition
public List<Service> getServicesByAttributeDefinition(PerunSession sess, AttributeDefinition attributeDefinition) Description copied from interface:ServicesManagerImplApiGet all services with given attribute.- Specified by:
getServicesByAttributeDefinitionin interfaceServicesManagerImplApi- Parameters:
sess- perun sessionattributeDefinition-- Returns:
- all services with given attribute
-
getServicesFromDestination
Description copied from interface:ServicesManagerImplApiReturn list of services this destination points to.- Specified by:
getServicesFromDestinationin interfaceServicesManagerImplApi- Parameters:
destinationId- ID of destination- Returns:
- Services associated with this destination.
-
isServiceAssignedToFacility
Description copied from interface:ServicesManagerImplApiChecks whether given service is assigned to given facility (through some resource).- Specified by:
isServiceAssignedToFacilityin interfaceServicesManagerImplApi- Parameters:
sess- sessionfacility- facilityservice- service- Returns:
- true if service is assigned to given facility, false otherwise
-
isServiceBlockedOnDestination
public boolean isServiceBlockedOnDestination(int serviceId, int destinationId) Description copied from interface:ServicesManagerImplApiReturn TRUE if Service is blocked on Destination.- Specified by:
isServiceBlockedOnDestinationin interfaceServicesManagerImplApi- Parameters:
serviceId- ID of Service to check on.destinationId- ID of Destination to check on.- Returns:
- TRUE if Service is blocked on Destination / FALSE otherwise
-
isServiceBlockedOnFacility
public boolean isServiceBlockedOnFacility(int serviceId, int facilityId) Description copied from interface:ServicesManagerImplApiReturn TRUE if Service is blocked on Facility.- Specified by:
isServiceBlockedOnFacilityin interfaceServicesManagerImplApi- Parameters:
serviceId- ID of Service to check on.facilityId- ID of Facility to check on.- Returns:
- TRUE if Service is blocked on Facility / FALSE otherwise
-
removeAllDestinations
Description copied from interface:ServicesManagerImplApiRemoves all defined destinations for the service and facility.- Specified by:
removeAllDestinationsin interfaceServicesManagerImplApi- Parameters:
sess-service-facility-
-
removeAllDestinations
Description copied from interface:ServicesManagerImplApiRemoves all defined destinations for the facility.- Specified by:
removeAllDestinationsin interfaceServicesManagerImplApi- Parameters:
sess-facility- the facility
-
removeAllRequiredAttributes
Description copied from interface:ServicesManagerImplApiDetate all required attributes from service- Specified by:
removeAllRequiredAttributesin interfaceServicesManagerImplApi- Parameters:
sess- perunSessionservice- service from which the attributes will be removed
-
removeDestination
public void removeDestination(PerunSession sess, Service service, Facility facility, Destination destination) throws DestinationAlreadyRemovedException Description copied from interface:ServicesManagerImplApiRemoves an destination from the facility and service.- Specified by:
removeDestinationin interfaceServicesManagerImplApi- Parameters:
sess-service-facility-destination- string contains destination address (mail, url, hostname, ...)- Throws:
DestinationAlreadyRemovedException
-
removeRequiredAttribute
public void removeRequiredAttribute(PerunSession sess, Service service, AttributeDefinition attribute) throws AttributeNotAssignedException Description copied from interface:ServicesManagerImplApiRemove required attribute from service. TODO If you try to remove attribute which is default for other Required attribute ...- Specified by:
removeRequiredAttributein interfaceServicesManagerImplApi- Parameters:
sess- perunSessionservice- service from which the attribute will be removedattribute- attribute to remove- Throws:
AttributeNotAssignedException
-
removeRequiredAttributes
public void removeRequiredAttributes(PerunSession sess, Service service, List<? extends AttributeDefinition> attributes) throws AttributeNotAssignedException Description copied from interface:ServicesManagerImplApiBatch version of removeRequiredAttribute- Specified by:
removeRequiredAttributesin interfaceServicesManagerImplApi- Throws:
AttributeNotAssignedException- See Also:
-
serviceExists
Description copied from interface:ServicesManagerImplApiCheck if service exists in underlaying data source.- Specified by:
serviceExistsin interfaceServicesManagerImplApi- Parameters:
sess- perun sessionservice- service to check- Returns:
- true if service exists in underlaying data source, false otherwise
-
unblockAllServicesOnDestination
public void unblockAllServicesOnDestination(int destinationId) Description copied from interface:ServicesManagerImplApiUnblock all blocked Services on specified Destination.- Specified by:
unblockAllServicesOnDestinationin interfaceServicesManagerImplApi- Parameters:
destinationId- ID of Destination we want to unblock all Services.
-
unblockAllServicesOnFacility
public void unblockAllServicesOnFacility(int facilityId) Description copied from interface:ServicesManagerImplApiUnblock all blocked Services on Facility.- Specified by:
unblockAllServicesOnFacilityin interfaceServicesManagerImplApi- Parameters:
facilityId- ID of Facility we want to unblock all Services.
-
unblockService
public void unblockService(int serviceId) Description copied from interface:ServicesManagerImplApiUnblock Service everywhere. If was not blocked, nothing happens.- Specified by:
unblockServicein interfaceServicesManagerImplApi- Parameters:
serviceId- ID of Service to unblock.
-
unblockServiceOnDestination
public void unblockServiceOnDestination(int serviceId, int destinationId) Description copied from interface:ServicesManagerImplApiUnblock Service on specific Destination. If was not blocked, nothing happens.- Specified by:
unblockServiceOnDestinationin interfaceServicesManagerImplApi- Parameters:
serviceId- ID of Service to unblock on Destination.destinationId- ID of Destination to unblock Service on.
-
unblockServiceOnFacility
public void unblockServiceOnFacility(int serviceId, int facilityId) Description copied from interface:ServicesManagerImplApiUnblock Service on whole Facility. If was not blocked, nothing happens.- Specified by:
unblockServiceOnFacilityin interfaceServicesManagerImplApi- Parameters:
serviceId- ID of Service to unblock on Facility.facilityId- ID of Facility to unblock Service on.
-
updateService
Description copied from interface:ServicesManagerImplApiUpdates the service.- Specified by:
updateServicein interfaceServicesManagerImplApi- Parameters:
sess-service-
-