Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] JSP Generator Problem resourceshape
  • From: Jan-Patrick Osterloh <osterloh@xxxxxxxx>
  • Date: Fri, 8 Nov 2019 11:15:58 +0100
  • Autocrypt: addr=osterloh@xxxxxxxx; prefer-encrypt=mutual; keydata= mQINBFaYzvABEAC6kSTwexU5Zme4Zc21MF2Zy+fsv8/nLPVgeTTGCY/3RJEoqpMzd+Ox7JR3 iSMkItkxTHu6Giw8YcMNbTM5ptoSTryDRMjLXvvMTmaWhPBlv66gvy6KJwfLawkQAubJKj32 rh1/7r9eT4s7iDSTLcabyHHx/9Ogvhm7feRwOvRB9u7ukcI7m4fEDZscvVZKwlcGD3wr1OtY BQIOhhEzS6XvumVTgLBN5NgtEk5MlAmFIQaBxYDt47D1QsDu7991Z2iFTuuybqrJL0vo8PAA Sqtjo0cSQu12NqU78D3zCOG8hU+kiXKW2DdmXnmkbyH1K/yztwSpNfbbOpi17CeD1snmAAEY akTtZKkVvtTa3Xg3GQ6yU/GVxFEZ+cLDViRSStL1gi5mnRHbHY7IyoEx1W/+GYPv5ripe2aB Y9c1a9l/1bLxWXAKwbD9haCHZ19lMfvF0eGn4Li3HyB5YHnhCCapoxIJJnOuDGPvaB5H+qv1 p8cxqN7p24Z6v3NZ0b7sEtQNHnq9IvJ2sSUVpHk9hy93ZNdAg3TqrQ09kN7elXxPy3xQ5OLr Q/PZTGi8bRMSShzSm8KPZy1FKzSWbYTLOtiw6HeM2s7tl+lPVD2+UH0mWleXPfZ7iaIwKa7m XlkwUSgh2dc5LvWBVCz0LiXz1NBiqrT70czodA62l1pQYLno2wARAQABtChKYW4tUGF0cmlj ayBPc3RlcmxvaCA8b3N0ZXJsb2hAb2ZmaXMuZGU+iQJCBBMBCAAsAhsjBwsJCAcDAgEGFQgC CQoLBBYCAwECHgECF4ACGQEFAluWVmQFCQbeuvQACgkQlxtC0YJWygwFGRAAgNfQK1yfY5Wf Mzz9W0JXdQZUwEg3rR4fLMNxwpu1q7OmEF784qKJ2CI0UeiUOozOGR4T8n2HhohW4P/iYSyV dR6Dsl7N/HBXZTUU4xCIFG6nSd/x6mcHC4pclcJbSUcnqChS3+cfMHL04V3unsidhI7qNO5k qyuPHfJPEHJdSOXYgdIkEFpwG8r8FLCuMOo5EXxMBQHCzbic7UE5jt5Rnz3YirQJwfhheDkj FvAh8QUUDN9mReDu7GKZkbfJfoyantLRnwjfQOmtUoDTZpUK09GGKEQAiKtge47FS5hCihpI K8OjAeLQ4XA4ZOExtmI5MaVCLZDXlkXJJlK8zhNFgVFZbGD+WVWpvHD24NShjPrdGMn2PhtY r3Q2m54PLY2ZhpRsGYrI53CLXPDvKaDzfZa+YysBsUe7CCAMHh/ZPKJhPGO1DSSK7DS3tR3s cn84OZRH3i/oSiktjsmnx/iitfVmSt279J8keKEyGtUvsI24i6WPEpldsYaVHdh0I5LVZBn6 y4DFOuJkCOO5dqhNIJC6KnQDcRXFq0MHdeKigUjdh1Rz5IJvf0SiOvRTuhzDUbTg9972jfeF YrWbjO2DWgdAwQ3+i7CiqvPdxMceiUsagALvHvUe5tdwUtRQXFpxcqb5jMTZsY/pQJouh/jZ 0+EYnS4iDVP7vzrxLEEhY5s=
  • Delivered-to: lyo-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/lyo-dev>
  • List-help: <mailto:lyo-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/lyo-dev>, <mailto:lyo-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/lyo-dev>, <mailto:lyo-dev-request@eclipse.org?subject=unsubscribe>
  • Openpgp: preference=signencrypt
  • User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Hi Jad,

I debugged this, and the getDescribes is indeed not empty:


In my ToolChain.xml, the resource shape for this looks like this:
<resources name="OSLCDictionary" resourceProperties="//@specification/@domainSpecifications.0/@resourceProperties.6 //@specification/@domainSpecifications.0/@resourceProperties.19 //@specification/@domainSpecifications.0/@resourceProperties.9 //@specification/@domainSpecifications.0/@resourceProperties.0 //@specification/@domainSpecifications.0/@resourceProperties.4 //@specification/@domainSpecifications.0/@resourceProperties.8" />

I've debugged a little bit, and it seems that when creating the ResourceShape in org.eclipse.lyo.oslc4j.core.model.ResourceShapeFactory in line 105 the resourceShapeAnnotations are not empty:
final OslcResourceShape resourceShapeAnnotation = resourceClass.getAnnotation(OslcResourceShape.class);
and this is then inserted in line 119 into the resourceShape...

It's a little bit difficult to debug this, because my debugger can't find the sources...

I'm on 4.0 SNAPSHOT, if this matters.

Best
JPO



Am 07.11.2019 um 22:47 schrieb Jad El-Khoury:

Hi Jan-Patrick,

 

Please see below!

 

regards

______________________________

Jad El-khoury, PhD

KTH Royal Institute of Technology

School of Industrial Engineering and Management, Mechatronics Division

Brinellvägen 83, SE-100 44 Stockholm, Sweden

Phone: +46(0)8 790 6877 Mobile: +46(0)70 773 93 45

jad@xxxxxx, www.kth.se

 

-----Original Message-----
From: lyo-dev-bounces@xxxxxxxxxxx <lyo-dev-bounces@xxxxxxxxxxx> On Behalf Of Jan-Patrick Osterloh
Sent: 07 November 2019 14:12
To: lyo-dev@xxxxxxxxxxx
Subject: [lyo-dev] JSP Generator Problem resourceshape

 

Hi everybody,

 

when I generate my project from scratch (I deleted all jsp files to get current versions of the files after I added more properties to my resources), then there is one problem in the resourceshape.jsp. It generates the following code in the "Describes" section:

 

79:                         <%for(URI next :

aResourceShape.getDescribes()) {%>

80:                             <li>

81:                                 <a href="">

82:                                     <%= next.toString().split("#")[1]%></a>

83:                             </li>

84:                         <%}%>

85:                     </ul>

 

My "Describes" are all "null", because I didnt set this property.

Side note: I can't set it because the editor just tells me "Please select a valid 'Class'", but I don't have anything in my project that is accepted as a valid class...

 

Jad: Here the editor is after a RDF Vocabulary Class. An OSLC shape describes such an rdf-Class. that’s what really defines the rdf:type. if you don’t define one, the generator takes the shape’s name as its type implicitly. So, it’s not wrong not to define the “describes” property in the model.

But, you can.  You define such classes under the Vocabularies section of you model. See attached picture!

You can’t see such a section? Then it is likely that you have an older model, before Vocabularies were introduced. If this is of interest, I can help you create it.

 

Nevertheless, if I then open any of the ResourceShapes in my model (.../services/resourceShapes/<ResourceShape>, I get an Exception:

 

An exception occurred processing JSP page /package/resourceshape.jsp at line 82 ...

java.lang.ArrayIndexOutOfBoundsException: 1

        at

org.apache.jsp.package.resourceshape_jsp._jspService(resourceshape_jsp.java:184)

        at

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

 

Jad: This is very strange, because you should not even be in this for-loop (line 79) if “aResourceShape.getDescribes()” is null/empty.

And I could not reproduce this problem for a similar model here.

Could you please check the size and content of “aResourceShape.getDescribes()”? Could you have somehow managed to fill it with some item which is not a “class”?

 

I have removed the for loop completely and this "fixes" the problem, but I think that might be better fixed in the generator template...

 

Best

Jan-Patrick

 

P.S. Is there an option to always regenerate the jsps? I just use them for "debugging", so from my point of view they could be updated...?

Jad: I’m with you on this one, because I also miss many bugs, since I don’t end up re-generating the jsp pages, which I use for debugging.

Earlier versions allowed regenerations of specific blocks within each jsps. But that was very inflexible. And there was a need to have full control over the jsp content.

That’s why we now put the whole file content between these “protected user-code” blocks.

 

My thoughts now: provide a check-box option on the adaptor that lets you (the modeller) decide whether to (a) surround the whole jsp-content within “protected user-code” or (b) no protected user-code, meaning all content in the jsp is re-generated.

What do you think? I created a issue on https://github.com/eclipse/lyo.designer/issues/128, so we can continue the dialog there.

 

--

Dipl. Inform. Jan-Patrick Osterloh

Senior Research Engineer

Human Centered Design Group

 

OFFIS e.V. - Institut für Informatik | Institute for Information Technology

             FuE Bereich Verkehr     | R&D Division Transportation

             Escherweg 2, 26121 Oldenburg - Germany

Room:        D107

Phone/Fax:   +49 441 97 22-524 / -502

E-Mail:      osterloh@xxxxxxxx

URL:         http://www.offis.de

 

Registergericht: Amtsgericht Oldenburg VR 1956

Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender),

          Prof. Dr. techn. Susanne Boll-Westermann,

          Prof. Dr.-Ing. Axel Hahn,

          Prof. Dr.-Ing. Andreas Hein,

          Prof. Dr. Sebastian Lehnhoff

 

Unsere Hinweise zum Datenschutz sind abrufbar unter:

https://www.offis.de/datentransparenz.html

 

_______________________________________________

lyo-dev mailing list

lyo-dev@xxxxxxxxxxx

To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/lyo-dev


_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/lyo-dev

-- 
Dipl. Inform. Jan-Patrick Osterloh
Senior Research Engineer
Human Centered Design Group

OFFIS e.V. - Institut für Informatik | Institute for Information Technology
             FuE Bereich Verkehr     | R&D Division Transportation
             Escherweg 2, 26121 Oldenburg - Germany
Room:        D107
Phone/Fax:   +49 441 97 22-524 / -502
E-Mail:      osterloh@xxxxxxxx
URL:         http://www.offis.de 

Registergericht: Amtsgericht Oldenburg VR 1956
Vorstand: Prof. Dr.-Ing. Wolfgang H. Nebel (Vorsitzender),
          Prof. Dr. techn. Susanne Boll-Westermann,
          Prof. Dr.-Ing. Axel Hahn,
          Prof. Dr.-Ing. Andreas Hein,
          Prof. Dr. Sebastian Lehnhoff 

Unsere Hinweise zum Datenschutz sind abrufbar unter: 
https://www.offis.de/datentransparenz.html

Back to the top