Skip to content

Commit 510c53b

Browse files
Update README.md
1 parent b61af29 commit 510c53b

File tree

1 file changed

+10
-10
lines changed
  • src/main/java/org/reactome/server/graph/aop

1 file changed

+10
-10
lines changed

src/main/java/org/reactome/server/graph/aop/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<img src=https://cloud.githubusercontent.com/assets/6883670/22938783/bbef4474-f2d4-11e6-92a5-07c1a6964491.png width=220 height=100 />
22

3-
Aspect Oriented Programming with Spring
3+
Aspect-Oriented Programming with Spring
44
===
55

66
:warning: Changes in this package have to be taken carefully, considering it is going to reflect in the whole application
77

88
### What is Aspect-Oriented Programming - AOP?
99

10-
Spring AOP framework is used to modularize cross-cutting concerns in aspects. Simply, t’s just an interceptor to intercept some processes, for example, when a method is execute, Spring AOP can hijack the executing method, and add extra functionality before or after the method execution. The most used feature is logging.
10+
Spring AOP framework is used to modularize cross-cutting concerns in aspects. Simply, it’s just an interceptor to intercept some processes, for example, when a method is executed, Spring AOP can hijack the executing method, and add extra functionality before or after the method execution. The most used feature is logging.
1111
However, in Reactome, we are taking benefit of this concept in order to implement our own Lazy-Loading mechanism. This functionality is also available in ORM frameworks, such as, Hibernate and to achieve this they are implementing AOP concepts. Sorting and Logging aspect are present as well.
1212

13-
Complete information of Spring AOP you'll find [here](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html).
13+
Complete information on Spring AOP you'll find [here](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html).
1414

15-
### What are the `@PointCut` in Reactome for LazyLoading ?
15+
### What are the `@PointCut` in Reactome for LazyLoading?
1616

1717
```java
1818
execution(public java.util.Collection<org.reactome.server.graph.domain.model.DatabaseObject+>+ org.reactome.server.graph.domain.model.*.get*(..))
@@ -24,7 +24,7 @@ execution(public org.reactome.server.graph.domain.model.DatabaseObject+ org.reac
2424
```
2525
Intercepting ALL the getters in our Domain Model whose return type is `DatabaseObject` or `instance of`
2626

27-
### How does it work ?
27+
### How does it work?
2828

2929
Mainly, we are loading DEPTH{2} data from the graph without any relationship previously loaded, only identifiers. Once intercepted, the code checks whether the AOP is enabled and whether the object has been loaded previously. Substantially using Java Reflection, the code is capable to identify all the information regarding the method that has been intercepted, for instance, return type (`Collection` or `DatabaseObject`) and `@Relationship` which contains important information for querying against the Graph. Up to this point, the data have been retrieve and the code invokes the setter and proceed.
3030

@@ -95,19 +95,19 @@ public LazyFetchAspect lazyFetchAspect() {
9595
</plugin>
9696
```
9797

98-
#### What is the flag `enableAOP` ?
98+
#### What is the flag `enableAOP`?
9999

100-
The AOP is enabled by default, but in certain projects like [Content Service](https://github.com/reactome-pwp/content-service.git) where we respond a serialised JSON, the `@PointCut` will be invoked every where, every time, endless times. Thus, given the requirements of the `Content Service` it makes sense that we disable this feature. However, in the [Data Content](https://github.com/reactome/data-content) we kept it enabled.
100+
The AOP is enabled by default, but in certain projects like [Content Service](https://github.com/reactome/content-service.git) where we respond a serialised JSON, the `@PointCut` will be invoked everywhere, every time, endless times. Thus, given the `Content Service` requirements, it makes sense that we disable this feature. However, we kept it enabled in the [Data Content](https://github.com/reactome/data-content).
101101

102102

103103
=
104104

105-
### SortingAspect ?
105+
### SortingAspect?
106106

107107
Intercepting ALL the getters in our Domain Model whose return type is `Collection<? extends DatabaseObject>` and sorting the list based on the `displayName`.
108108

109109
=
110110

111-
### LoggingAspect ?
111+
### LoggingAspect?
112112

113-
Logging everything at the service level. The package `service` is being intercepted in order to measure the execution time.
113+
Logging everything at the service level. The package `service` is being intercepted to measure the execution time.

0 commit comments

Comments
 (0)