-
Notifications
You must be signed in to change notification settings - Fork 315
Add Observation implementation #1438
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add Observation implementation #1438
Conversation
Ping @corneil |
@johkin Thanks for this great contribution. |
...java/org/springframework/ws/client/core/observation/DefaultWebServiceTemplateConvention.java
Show resolved
Hide resolved
...java/org/springframework/ws/client/core/observation/DefaultWebServiceTemplateConvention.java
Outdated
Show resolved
Hide resolved
...g/springframework/ws/client/core/observation/WebServiceTemplateObservationDocumentation.java
Show resolved
Hide resolved
...g/springframework/ws/client/core/observation/WebServiceTemplateObservationDocumentation.java
Outdated
Show resolved
Hide resolved
.../org/springframework/ws/server/endpoint/observation/DefaultWebServiceEndpointConvention.java
Show resolved
Hide resolved
.../org/springframework/ws/server/endpoint/observation/DefaultWebServiceEndpointConvention.java
Outdated
Show resolved
Hide resolved
...ava/org/springframework/ws/server/endpoint/observation/EndpointObservationDocumentation.java
Show resolved
Hide resolved
...ava/org/springframework/ws/server/endpoint/observation/EndpointObservationDocumentation.java
Outdated
Show resolved
Hide resolved
...ava/org/springframework/ws/server/endpoint/observation/EndpointObservationDocumentation.java
Show resolved
Hide resolved
Changed name of key "localname" to "localpart" Removed superfluos method implementations Modified implementation of ContextualName spring-projects#1094
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the work on this. It's a very complete pull request. I left some feedback for consideration.
...ava/org/springframework/ws/client/core/observation/WebServiceTemplateObservationContext.java
Outdated
Show resolved
Hide resolved
...g/springframework/ws/client/core/observation/WebServiceTemplateObservationDocumentation.java
Outdated
Show resolved
Hide resolved
...ava/org/springframework/ws/server/endpoint/observation/EndpointObservationDocumentation.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/ws/server/endpoint/observation/WebServiceEndpointContext.java
Outdated
Show resolved
Hide resolved
...-core/src/test/java/org/springframework/ws/server/endpoint/observation/WebServiceConfig.java
Outdated
Show resolved
Hide resolved
...springframework/ws/client/core/observation/WebServiceTemplateObservationIntegrationTest.java
Show resolved
Hide resolved
...in/java/org/springframework/ws/client/core/observation/WebServiceObservationInterceptor.java
Outdated
Show resolved
Hide resolved
...in/java/org/springframework/ws/client/core/observation/WebServiceObservationInterceptor.java
Outdated
Show resolved
Hide resolved
...in/java/org/springframework/ws/client/core/observation/WebServiceObservationInterceptor.java
Outdated
Show resolved
Hide resolved
...in/java/org/springframework/ws/client/core/observation/WebServiceObservationInterceptor.java
Outdated
Show resolved
Hide resolved
...in/java/org/springframework/ws/client/core/observation/WebServiceObservationInterceptor.java
Outdated
Show resolved
Hide resolved
...in/java/org/springframework/ws/client/core/observation/WebServiceObservationInterceptor.java
Show resolved
Hide resolved
...src/main/java/org/springframework/ws/server/endpoint/observation/ObservationInterceptor.java
Outdated
Show resolved
Hide resolved
...rg/springframework/ws/server/endpoint/observation/ObservationInterceptorIntegrationTest.java
Show resolved
Hide resolved
I did some minor restructuring of the code to improve readability and error-handling/logging. The method used to find the root element is identical in both interceptors, could be and improvement to refactor this to a helper-class? On the other hand, this requires the helper to be injected in the interceptors and creates another dependency. |
* DefaultHandler that extracts the root elements namespace and name. | ||
* @author Johan Kindgren | ||
*/ | ||
public class RootElementSAXHandler extends DefaultHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be public or can it be package-private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. I was looking at old commits.
|
||
private final SAXParser saxParser; | ||
|
||
public ObservationHelper() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to have multiple instances of this class? Could it be a singleton utility class instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or alternatively, could the public method be static and it not have a public constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could certainly be a singleton, is something like this what you had in mind:
`java
private static ObservationHelper INSTANCE;
public static ObservationHelper getInstance() {
if (INSTANCE == null) {
INSTANCE = new ObservationHelper();
}
return INSTANCE;
}
private ObservationHelper() {
`
Also noted that a minor bug slipped through the tests, I have a fix in place locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be one option. I'll leave it up to @corneil to advise on what makes most sense given existing patterns used in this codebase.
@johkin when I checkout the PR and run
|
Yes, I noticed the test-failures yesterday. I've updated the code to handle the issue correctly. |
@corneil Did you see my fix for the tests, and also if you have any preference for the solution of ObservationHelper? Should it be a singleton in code or a singleton managed by Spring? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good.
Thank you @johkin
I will merge when the build is stable.
@snicoll |
I honestly don’t know. I’ve started to review the initial commit with @bclozel and it needs more work. We’re also late in the 4.1 cycle with GA happening in May already. |
@johkin we've looked at it and we've started 4.1.x dev very late for the May train so this will have to move. |
If there are anything that could be done to help out, please let me know. |
Initial implementation of observation for spring-ws.
Please feel free to comment and provide feedback.
#1094