use of io.joynr.JoynrVersion in project joynr by bmwcarit.
the class RequestInterpreter method execute.
public void execute(final ProviderCallback<Reply> callback, RequestCaller requestCaller, final Request request) {
Promise<? extends AbstractDeferred> promise;
logger.debug("execute request on provider: {}", request);
try {
promise = (Promise<?>) invokeMethod(requestCaller, request);
} catch (MethodInvocationException | ProviderRuntimeException e) {
logger.warn("execute request on provider failed with exception: {}, request: {}", e, request);
callback.onFailure(e);
return;
} catch (Exception e) {
JoynrVersion joynrVersion = AnnotationUtil.getAnnotation(requestCaller.getProxy().getClass(), JoynrVersion.class);
MethodInvocationException methodInvocationException = new MethodInvocationException(e, new Version(joynrVersion.major(), joynrVersion.minor()));
logger.warn("execute request on provider failed with exception: {}, request: {}", methodInvocationException, request);
callback.onFailure(methodInvocationException);
return;
}
promise.then(new PromiseListener() {
@Override
public void onRejection(JoynrException error) {
logger.debug("execute request on provider onRejection: {}, request: {}", error, request);
callback.onFailure(error);
}
@Override
public void onFulfillment(Object... values) {
logger.debug("execute request on provider onFulfillment: {}, request: {}", values, request);
callback.onSuccess(createReply(request, values));
}
});
}
use of io.joynr.JoynrVersion in project joynr by bmwcarit.
the class RequestInterpreter method ensureMethodMetaInformationPresent.
private void ensureMethodMetaInformationPresent(RequestCaller requestCaller, OneWayRequest request, MethodSignature methodSignature) {
try {
if (!methodSignatureToMethodMap.containsKey(methodSignature)) {
Method method;
method = ReflectionUtils.findMethodByParamTypeNames(methodSignature.getRequestCaller().getProxy().getClass(), methodSignature.getMethodName(), methodSignature.getParameterTypeNames());
methodSignatureToMethodMap.putIfAbsent(methodSignature, method);
}
} catch (NoSuchMethodException e) {
logger.error("RequestInterpreter: Received an RPC invocation for a non existing method" + request, e);
JoynrVersion joynrVersion = AnnotationUtil.getAnnotation(requestCaller.getProxy().getClass(), JoynrVersion.class);
throw new MethodInvocationException(e.toString(), new Version(joynrVersion.major(), joynrVersion.minor()));
}
}
use of io.joynr.JoynrVersion in project joynr by bmwcarit.
the class AnnotationUtilTest method testMinorVersionAnnotation.
@Test
public void testMinorVersionAnnotation() {
JoynrVersion joynrVersionnAnnotation = AnnotationUtil.getAnnotation(DefaulttestProvider.class, JoynrVersion.class);
assertThat(joynrVersionnAnnotation.minor(), equalTo(11));
}
use of io.joynr.JoynrVersion in project joynr by bmwcarit.
the class AnnotationUtilTest method testMajorVersionAnnotation.
@Test
public void testMajorVersionAnnotation() {
JoynrVersion joynrVersionnAnnotation = AnnotationUtil.getAnnotation(DefaulttestProvider.class, JoynrVersion.class);
assertThat(joynrVersionnAnnotation.major(), equalTo(47));
}
use of io.joynr.JoynrVersion in project joynr by bmwcarit.
the class VersionUtil method getVersionFromAnnotation.
public static Version getVersionFromAnnotation(Class<?> annotatedClass) {
JoynrVersion versionAnnotation = AnnotationUtil.getAnnotation(annotatedClass, JoynrVersion.class);
if (versionAnnotation == null) {
throw new IllegalStateException("No @JoynrVersion found on " + annotatedClass);
}
Version version = new Version(versionAnnotation.major(), versionAnnotation.minor());
logger.trace("Created version {} for interface class {}", version, annotatedClass);
return version;
}
Aggregations