git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/data-analysis/52n-wps-algorithm-d4s/3.6@154945 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b95572fe28
commit
543f765d09
7
pom.xml
7
pom.xml
|
@ -11,7 +11,7 @@
|
|||
<groupId>org.gcube.dataanalysis</groupId>
|
||||
<artifactId>52n-wps-algorithm-gcube</artifactId>
|
||||
<name>52North WPS Algorithm API modified for gcube</name>
|
||||
<version>3.6.1-SNAPSHOT</version>
|
||||
<version>3.6.2-SNAPSHOT</version>
|
||||
<description>API for implementation of algorithms to be exposed as web processes</description>
|
||||
|
||||
<licenses>
|
||||
|
@ -76,11 +76,6 @@
|
|||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.12.1.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.n52.wps</groupId>
|
||||
<artifactId>52n-wps-commons</artifactId>
|
||||
|
|
|
@ -29,11 +29,6 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javassist.ClassClassPath;
|
||||
import javassist.ClassPool;
|
||||
import javassist.CtClass;
|
||||
import javassist.CtMethod;
|
||||
|
||||
import org.n52.wps.algorithm.annotation.AnnotationBinding.ExecuteMethodBinding;
|
||||
import org.n52.wps.algorithm.annotation.AnnotationBinding.InputBinding;
|
||||
import org.n52.wps.algorithm.annotation.AnnotationBinding.OutputBinding;
|
||||
|
@ -155,19 +150,18 @@ public class AnnotatedAlgorithmIntrospector {
|
|||
//MODIFICATIONS BY G CORO TO ACCOUNT FOR METHODS ORDER
|
||||
List<Method> sortedMethods = new ArrayList<Method>();
|
||||
List<Integer> methodsIdxs = new ArrayList<Integer>();
|
||||
List<Method> notOrderedMethod = new ArrayList<Method>();
|
||||
try{
|
||||
for (Method m:algorithmClass.getDeclaredMethods()){
|
||||
//System.out.println("Javaassist Analysing method "+m.getName());
|
||||
ClassPool pool = ClassPool.getDefault();
|
||||
ClassClassPath ccpath = new ClassClassPath(m.getDeclaringClass());
|
||||
pool.insertClassPath(ccpath);
|
||||
//System.out.println("Javaassist searching for canonical name "+m.getDeclaringClass().getCanonicalName());
|
||||
CtClass cc = pool.get(m.getDeclaringClass().getCanonicalName());
|
||||
//System.out.println("Javaassist cc "+cc.getName());
|
||||
CtMethod javassistMethod = cc.getDeclaredMethod(m.getName());
|
||||
//System.out.println("Javaassist method "+javassistMethod.getName());
|
||||
|
||||
int linenumber = javassistMethod.getMethodInfo().getLineNumber(0);
|
||||
|
||||
if (!m.isAnnotationPresent(MethodOrder.class)){
|
||||
LOGGER.warn("METHOD {} in not annotated with MethodOrder in class {}", m.getName(), algorithmClass.getSimpleName());
|
||||
notOrderedMethod.add(m);
|
||||
continue;
|
||||
}
|
||||
|
||||
int linenumber = m.getAnnotation(MethodOrder.class).value();
|
||||
//System.out.println("Javaassist line number "+linenumber);
|
||||
int i=0;
|
||||
for (Integer methodsIdx :methodsIdxs){
|
||||
|
@ -182,7 +176,7 @@ public class AnnotatedAlgorithmIntrospector {
|
|||
}catch(Exception e){
|
||||
LOGGER.warn("error getting method order",e);
|
||||
}
|
||||
|
||||
sortedMethods.addAll(notOrderedMethod);
|
||||
Method[] sMethods = sortedMethods.toArray(new Method[sortedMethods.size()]);
|
||||
|
||||
algorithmBuilder = AlgorithmDescriptor.builder(
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package org.n52.wps.algorithm.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface MethodOrder {
|
||||
|
||||
int value() default Integer.MAX_VALUE;
|
||||
}
|
Loading…
Reference in New Issue