|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=CLASS) @Target(value=TYPE) public @interface AspectService
Annotates an Aspect service. Aspects allow you to define an interceptor, or chain of interceptors for a service (to add features like caching or logging, etc ...). The dependency manager intercepts the original service, and allows you to execute some code before invoking the original service ... The aspect will be applied to any service that matches the specified interface and filter and will be registered with the same interface and properties as the original service, plus any extra properties you supply here. It will also inherit all dependencies, and if you declare the original service as a member it will be injected.
Here, the AspectService is registered into the OSGI registry each time an InterceptedService is found from the registry. The AspectService class intercepts the InterceptedService, and decorates its "doWork()" method. This aspect uses a rank with value "10", meaning that it will intercept some other eventual aspects with lower ranks. The Aspect also uses a service property (param=value), and include eventual service properties found from the InterceptedService:
@AspectService(ranking=10), properties={@Property(name="param", value="value")}) class AspectService implements InterceptedService { // The service we are intercepting (injected by reflection) protected InterceptedService intercepted; public void doWork() { intercepted.doWork(); } }
Required Element Summary | |
---|---|
int |
ranking
Sets the ranking of this aspect. |
Optional Element Summary | |
---|---|
String |
factoryMethod
Sets the static method used to create the AspectService implementation instance. |
String |
field
Sets the field name where to inject the original service. |
String |
filter
Sets the filter condition to use with the service interface this aspect is applying to. |
Property[] |
properties
Sets Additional properties to use with the aspect service registration |
|
service
Sets the service interface to apply the aspect to. |
Element Detail |
---|
public abstract int ranking
public abstractservice
public abstract String filter
public abstract Property[] properties
public abstract String field
public abstract String factoryMethod
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |