Package org.silverpeas.core
Class ApplicationServiceProvider
- java.lang.Object
-
- org.silverpeas.core.ApplicationServiceProvider
-
@Provider @Singleton public class ApplicationServiceProvider extends Object
A provider of objets implementing theApplicationService
interface. The provider looks for an implementation of theApplicationService
interface by the identifier of the application instance. In order the discovery of such a service succeeds, it is required that each implementation are annotated by the @Named
annotation with as value the name of the component with the first character in lowercase following by the termService
; for example an applicationToto
should provide an implementation of theApplicationService
interface named (with theNamed
annotation)totoService
.- Author:
- mmoquillon
-
-
Field Summary
Fields Modifier and Type Field Description static String
SERVICE_NAME_SUFFIX
The suffix to use when naming a service satisfying theApplicationService
interface with theNamed
annotation.
-
Constructor Summary
Constructors Constructor Description ApplicationServiceProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ApplicationServiceProvider
get()
Gets an instance of theApplicationServiceProvider
class.Optional<ApplicationService>
getApplicationServiceById(String appId)
Gets the application service that is defined for the given application instance.
-
-
-
Field Detail
-
SERVICE_NAME_SUFFIX
public static final String SERVICE_NAME_SUFFIX
The suffix to use when naming a service satisfying theApplicationService
interface with theNamed
annotation.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public static ApplicationServiceProvider get()
Gets an instance of theApplicationServiceProvider
class.- Returns:
- an
ApplicationServiceProvider
instance.
-
getApplicationServiceById
public Optional<ApplicationService> getApplicationServiceById(String appId)
Gets the application service that is defined for the given application instance. If no such application service exists, then nothing is returned.- Parameters:
appId
- the unique identifier of an application instance in Silverpeas.- Returns:
- optionally the transverse service that is defined for the type of applications the given component instance is of. If no such application service exists, then nothing is returned.
-
-