crossminer / scava

https://eclipse.org/scava/
Eclipse Public License 2.0
18 stars 13 forks source link

CROSSIndex and Eclipse plugin #387

Open creat89 opened 4 years ago

creat89 commented 4 years ago

Hello,

I open this issue as it I might not be the case that the recommender created for exploiting the indexes is present through the Eclipse plugin. The recommender is located in the KB and it's available through the same REST API that the recommenders and tools created by UDA.

This recommender is associated to four API methods, depending on the programming language to process, C, Java, PHP and Javascript. It has for input a portion of the code being developed.

The returned object is the same that UDA recommender send.

Would it be possible to create an interface similar to those used by UDA recommenders?

creat89 commented 4 years ago

We use the same REST that other recommenders created by UDA:

https://github.com/crossminer/scava/blob/dev/knowledge-base/org.eclipse.scava.knowledgebase/src/main/java/org/eclipse/scava/presentation/rest/RecommenderRestController.java

Specifically, we use the methods:

Which can be found in:

https://github.com/crossminer/scava/blob/3a34a79e6d9a12576514ffb2af6c2ebdcd89a9a3/knowledge-base/org.eclipse.scava.knowledgebase/src/main/java/org/eclipse/scava/presentation/rest/RecommenderRestController.java#L130-#L156

geryxyz commented 4 years ago

Maybe I miss something but could you give us a use case with sample data for these requests?

creat89 commented 4 years ago

Hello, I hope I had understood well, here is an example:

curl -X POST "http://localhost:8080/api/recommendation/crossindex-java/"
 -H "accept: application/xml"
 -H "Content-Type: application/json"
 -d "{ \"compilationUnit\": \"package camelinaction;import org.apache.c amel.CamelContext;import org.apache.camel.builder.RouteBuilder;import org.apache.camel.impl.DefaultCamelContext;public class FilePrinter{ public static void main (String[] args) throws Exception{ CamelContext c ontext = new DefaultCamelContext(); context.addRoutes(new RouteBuilder(){ public void configure(){} }); }}\"}"

In the compilationUnit it goes the code that the developer is creating on Eclipse. This should be similar to other recommenders, such as SORecommeder.

The URL could be:

Currently it seems a bug in the KB regarding versions of the Lucene in the maven, but that's another issue.

creat89 commented 4 years ago

I have updated the curl example to properly have a running example