public abstract class OsgiAbstractJobProducerEndpoint<A> extends AbstractJobProducerEndpoint
AbstractJobProducerEndpoint suitable for use in an
OSGi environment.
OSGi dependency injection methods are provided to reduce the amount of boilerplate code needed per service implementation.
Declare as type variable the job producing service on which the endpoint depends.
Example: The endpoint for the WorkflowService can be declared like this:
public final class WorkflowServiceEndpoint extends OsgiAbstractJobProducerEndpoint<WorkflowServiceImpl>
Implementation note: Type variable A cannot have upper bound
JobProducer. Even though this may seem reasonable it will cause trouble
with OSGi dependency injection. The dependency will most likely be declared on the service's interface
and not the concrete implementation. But only the concrete implementation is a JobProducer.
With A having an upper bound of JobProducer the signature of setService(Object)
will be fixed to that bound: setService(JobProducer). Now the service cannot be injected anymore.
| Constructor and Description |
|---|
OsgiAbstractJobProducerEndpoint() |
| Modifier and Type | Method and Description |
|---|---|
JobProducer |
getService()
Returns the job producer that is backing this REST endpoint.
|
ServiceRegistry |
getServiceRegistry()
Return the service registry.
|
A |
getSvc() |
void |
setService(A service) |
void |
setServiceRegistry(ServiceRegistry serviceRegistry) |
checkHeartbeat, dispatchJobpublic JobProducer getService()
AbstractJobProducerEndpointgetService in class AbstractJobProducerEndpointpublic void setService(A service)
public A getSvc()
public ServiceRegistry getServiceRegistry()
AbstractJobProducerEndpointgetServiceRegistry in class AbstractJobProducerEndpointpublic void setServiceRegistry(ServiceRegistry serviceRegistry)
Copyright © 2009–2021 Opencast Project. All rights reserved.