-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility to modify JenaModel before response is returned by JMH/JaxRsProviders #76
Comments
How about the following proposal?
|
(2) is very much not thread safe. please do not any more static stuff to that class. (1) Visitor pattern is in my opinion not needed here and JAX-RS interceptors are a much better fit https://docs.jboss.org/resteasy/docs/4.0.0.Final/userguide/html/Interceptors.html#d4e2053 |
I'm left with a nagging feeling about data integrity and what actually constitutes a resource representation. Are we crossing into the ETL domain? Can clients have a reasonable expectation about the provenance of the resources? Maybe I'm overthinking this. |
Right, JAX-RS interceptors would also allow Lyo not to step into that area either. But I agree with Jad that such hacks are very much needed in the OSLC space, sadly, and Lyo should at least provide for a way to get the job done. |
Practical advice (did not try, but that's how I would do it):
|
We may want to revive https://github.com/eclipse/lyo.core/pull/76/files#diff-0f7af1eb04acfdfbffe4b21db24c1c2c0ba064f2a1d537d6a763bda00afe6166 and also add a standard writer for a Jena Model. |
I looked into JAX-RS interceptors. The problem there is that one will receive a stream, and then one will have to reconstruct the Jena model before it can be modified. I wanted to catch the return results as a Jena model. @jim! Not sure I understood your reservation, because this is not related to client/server. Sometimes it is just not enough to rely on the annotations to tell JMH what to do. A good example is the SysmlServer, where we wanted to perform some changes to the Jena model. For example, adding a new property, or changing a value of a property. In my new case, I want to serialize/deserialize an object in a custom way, and I can't do that using annotations. |
but point taken about concurrency. I will look into your many pointers. |
Jad, I assume there should be a way to intercept a JAX-RS response before the streams are involved. Let's try to have a Zoom session quickly to check this. |
The Jax-RS Provider writes to the stream. so unless we modify the JenaProviders we have built, I can't see how the Jax-RS Interceptors can work to embed code in the middle of the Provider. |
Can we introduce a mechanism that allows the devleoper to manipulate the response returned by LyoCore?
This would be done by either allowing custom functionality in JenaHelper, or AbstractOslcRdfXmlProvider?
https://github.com/eclipse/lyo/blob/b5f7207f969b4d31f0dc52756bf61229110e75b3/core/oslc4j-jena-provider/src/main/java/org/eclipse/lyo/oslc4j/provider/jena/AbstractOslcRdfXmlProvider.java#L146
@berezovskyi @jamsden! Any tips on how we can do this elegantly?
The text was updated successfully, but these errors were encountered: