Package org.opencastproject.search.impl
Class SearchServiceImpl
java.lang.Object
org.opencastproject.job.api.AbstractJobProducer
org.opencastproject.search.impl.SearchServiceImpl
- All Implemented Interfaces:
JobProducer,SearchService,StaticFileAuthorization
public final class SearchServiceImpl
extends AbstractJobProducer
implements SearchService, StaticFileAuthorization
An Opensearch-based
SearchService implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opencastproject.search.api.SearchService
SearchService.IndexEntryType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key to look for in the service configuration file to override theDEFAULT_ADD_JOB_LOADstatic final floatThe load introduced on the system by creating an add jobstatic final floatThe load introduced on the system by creating a delete jobstatic final StringThe key to look for in the service configuration file to override theDEFAULT_DELETE_JOB_LOADstatic final StringThe job typeprotected OrganizationDirectoryServiceThe organization directory serviceprotected UserDirectoryServiceThe user directory serviceFields inherited from class org.opencastproject.job.api.AbstractJobProducer
ACCEPT_JOB_LOADS_EXCEEDING_PROPERTY, acceptJobLoadsExeedingMaxLoad, DEFAULT_ACCEPT_JOB_LOADS_EXCEEDING, executor, jobType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(org.osgi.service.component.ComponentContext cc) Service activator, called via declarative services configuration.add(MediaPackage mediaPackage) Adds the media package to the search index.voidaddSynchronously(MediaPackage mediaPackage) Immediately adds the mediapackage to the search index.Removes the media package identified bymediaPackageIdfrom the search index.deleteSeries(String seriesId) Removes the series identified byseriseIdfrom the search index.booleandeleteSynchronously(String mediaPackageId) Immediately removes the given mediapackage from the search service.Gets theMediaPackagefor an event, based on its mediapackage ID.protected OrganizationDirectoryServiceReturns a reference to the organization directory service.Get the list of URL patterns the service is responsible for.protected SecurityServiceReturns a reference to the security serviceCollection<org.apache.commons.lang3.tuple.Pair<Organization, MediaPackage>> Returns a list ofOrganization,MediaPackagepairs of mediapackages within a series.protected ServiceRegistryReturns a reference to the service registry.protected UserDirectoryServiceReturns a reference to the user directory servicevoidprotected StringAsks the overriding class to process the arguments using the given operation.search(org.elasticsearch.search.builder.SearchSourceBuilder searchSource) Searches the index based on aSearchSourceBuilder's queryvoidsetOrganizationDirectoryService(OrganizationDirectoryService organizationDirectory) Sets a reference to the organization directory service.voidsetPersistence(SearchServiceDatabase persistence) voidvoidsetSecurityService(SecurityService securityService) Callback for setting the security service.voidsetServiceRegistry(ServiceRegistry serviceRegistry) voidsetUserDirectoryService(UserDirectoryService userDirectoryService) Callback for setting the user directory service.booleanverifyUrlAccess(String path) Check a given path for access.Methods inherited from class org.opencastproject.job.api.AbstractJobProducer
acceptJob, countJobs, finallyUpdateJob, getJobType, incident, isReadyToAccept, isReadyToAcceptJobs
-
Field Details
-
JOB_TYPE
The job type- See Also:
-
DEFAULT_ADD_JOB_LOAD
public static final float DEFAULT_ADD_JOB_LOADThe load introduced on the system by creating an add job- See Also:
-
DEFAULT_DELETE_JOB_LOAD
public static final float DEFAULT_DELETE_JOB_LOADThe load introduced on the system by creating a delete job- See Also:
-
ADD_JOB_LOAD_KEY
The key to look for in the service configuration file to override theDEFAULT_ADD_JOB_LOAD- See Also:
-
DELETE_JOB_LOAD_KEY
The key to look for in the service configuration file to override theDEFAULT_DELETE_JOB_LOAD- See Also:
-
userDirectoryService
The user directory service -
organizationDirectory
The organization directory service
-
-
Constructor Details
-
SearchServiceImpl
public SearchServiceImpl()Creates a new instance of the search service.
-
-
Method Details
-
activate
Service activator, called via declarative services configuration.- Overrides:
activatein classAbstractJobProducer- Parameters:
cc- the component context- Throws:
IllegalStateException
-
add
Adds the media package to the search index.- Specified by:
addin interfaceSearchService- Parameters:
mediaPackage- the media package- Throws:
SearchException- if an error occurs while adding the media packageIllegalArgumentException- See Also:
-
addSynchronously
public void addSynchronously(MediaPackage mediaPackage) throws SearchException, IllegalArgumentException, UnauthorizedException Description copied from interface:SearchServiceImmediately adds the mediapackage to the search index.- Specified by:
addSynchronouslyin interfaceSearchService- Parameters:
mediaPackage- the media package- Throws:
SearchException- if the media package cannot be added to the search indexIllegalArgumentException- if the mediapackage isnullUnauthorizedException- if the user does not have the rights to add the mediapackage
-
getSeries
public Collection<org.apache.commons.lang3.tuple.Pair<Organization,MediaPackage>> getSeries(String seriesId) Description copied from interface:SearchServiceReturns a list ofOrganization,MediaPackagepairs of mediapackages within a series. Note that the Organization should always be the same since series should not cross organizational bounds.- Specified by:
getSeriesin interfaceSearchService- Parameters:
seriesId- the series ID to query- Returns:
- A list of
Organization,MediaPackagepairs of mediapackages within the series.
-
delete
Removes the media package identified bymediaPackageIdfrom the search index.- Specified by:
deletein interfaceSearchService- Parameters:
mediaPackageId- id of the media package to remove- Returns:
trueif the episode was found and deleted- Throws:
SearchException- if an error occurs while removing the media package- See Also:
-
deleteSynchronously
Description copied from interface:SearchServiceImmediately removes the given mediapackage from the search service.- Specified by:
deleteSynchronouslyin interfaceSearchService- Parameters:
mediaPackageId- the mediapackage- Returns:
trueif the mediapackage was deleted- Throws:
SearchException- if deletion failed
-
deleteSeries
Removes the series identified byseriseIdfrom the search index. Does *not* remove the associated events from the index!- Specified by:
deleteSeriesin interfaceSearchService- Parameters:
seriesId- id of the series to remove- Returns:
trueif the series was found and deleted- Throws:
SearchException- if an error occurs while removing the series- See Also:
-
get
Description copied from interface:SearchServiceGets theMediaPackagefor an event, based on its mediapackage ID.- Specified by:
getin interfaceSearchService- Parameters:
mediaPackageId- The ID of the mediapackage in question- Returns:
- The
MediaPackage - Throws:
NotFoundException- If the mediapackage is not found.UnauthorizedException- if the current user is not authorized to view this mediapackage.
-
search
public SearchResultList search(org.elasticsearch.search.builder.SearchSourceBuilder searchSource) throws SearchException Description copied from interface:SearchServiceSearches the index based on aSearchSourceBuilder's query- Specified by:
searchin interfaceSearchService- Parameters:
searchSource- TheSearchSourceBuilderdefining the search query- Returns:
- A
SearchResultListof the search's results - Throws:
SearchException- If an error occurs while searching the index.
-
process
Description copied from class:AbstractJobProducerAsks the overriding class to process the arguments using the given operation. The result will be added to the associated job as the payload.- Specified by:
processin classAbstractJobProducer- Parameters:
job- the job to process- Returns:
- the operation result
- Throws:
Exception- See Also:
-
setSearchIndex
-
setPersistence
-
setServiceRegistry
-
setSecurityService
Callback for setting the security service.- Parameters:
securityService- the securityService to set
-
setUserDirectoryService
Callback for setting the user directory service.- Parameters:
userDirectoryService- the userDirectoryService to set
-
setOrganizationDirectoryService
Sets a reference to the organization directory service.- Parameters:
organizationDirectory- the organization directory
-
getOrganizationDirectoryService
Description copied from class:AbstractJobProducerReturns a reference to the organization directory service.- Specified by:
getOrganizationDirectoryServicein classAbstractJobProducer- Returns:
- the organization directory service
- See Also:
-
getSecurityService
Description copied from class:AbstractJobProducerReturns a reference to the security service- Specified by:
getSecurityServicein classAbstractJobProducer- Returns:
- the security service
- See Also:
-
getServiceRegistry
Description copied from class:AbstractJobProducerReturns a reference to the service registry.- Specified by:
getServiceRegistryin classAbstractJobProducer- Returns:
- the service registry
- See Also:
-
getUserDirectoryService
Description copied from class:AbstractJobProducerReturns a reference to the user directory service- Specified by:
getUserDirectoryServicein classAbstractJobProducer- Returns:
- the user directory service
- See Also:
-
modified
-
getProtectedUrlPattern
Description copied from interface:StaticFileAuthorizationGet the list of URL patterns the service is responsible for.- Specified by:
getProtectedUrlPatternin interfaceStaticFileAuthorization- Returns:
- List of pattern matchers
-
verifyUrlAccess
Description copied from interface:StaticFileAuthorizationCheck a given path for access.- Specified by:
verifyUrlAccessin interfaceStaticFileAuthorization- Parameters:
path- Path to check- Returns:
- if access is allowed
-