Skip to content

Commit 50f4f86

Browse files
authored
Merge pull request #777 from scalecube/develop
New release
2 parents 6b3c3ed + 2a5104d commit 50f4f86

File tree

99 files changed

+2176
-1556
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2176
-1556
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ addons:
44
- libxml-xpath-perl
55
sudo: required
66
language: java
7-
jdk: openjdk11
7+
jdk: openjdk8
88
before_install:
99
- "./src/main/scripts/ci/before-install.sh"
1010
- "./src/main/scripts/cd/before-deploy.sh"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[![Build Status](https://travis-ci.org/scalecube/scalecube-services.svg?branch=develop)](https://travis-ci.org/scalecube/scalecube-services)
33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5e2ee9be41f7425590313ee1b8f737d7)](https://app.codacy.com/app/ScaleCube/scalecube-services?utm_source=github.com&utm_medium=referral&utm_content=scalecube/scalecube-services&utm_campaign=badger)
44
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.scalecube/scalecube-services-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.scalecube/scalecube-services-api)
5+
[![SourceSpy Dashboard](https://sourcespy.com/shield.svg)](https://sourcespy.com/github/scalecubescalecubeservices/)
56

67
## MICROSERVICES 2.0
78

docs/index.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

pom.xml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<modelVersion>4.0.0</modelVersion>
44

55
<artifactId>scalecube-services-parent</artifactId>
6-
<version>2.9.1-SNAPSHOT</version>
6+
<version>2.10.0-SNAPSHOT</version>
77

88
<parent>
99
<groupId>io.scalecube</groupId>
1010
<artifactId>scalecube-parent-pom</artifactId>
11-
<version>0.1.1</version>
11+
<version>0.1.2-RC3</version>
1212
</parent>
1313
<packaging>pom</packaging>
1414

@@ -22,19 +22,17 @@
2222
</scm>
2323

2424
<properties>
25-
<jackson.version>2.10.0.pr1</jackson.version>
26-
<scalecube-cluster.version>2.4.10</scalecube-cluster.version>
27-
<scalecube-commons.version>1.0.2</scalecube-commons.version>
25+
<jackson.version>2.11.0</jackson.version>
26+
<scalecube-cluster.version>2.6.0-RC3</scalecube-cluster.version>
27+
<scalecube-commons.version>1.0.7</scalecube-commons.version>
2828
<scalecube-benchmarks.version>1.2.2</scalecube-benchmarks.version>
29-
<scalecube-config.version>0.4.3</scalecube-config.version>
30-
<reactor.version>Dysprosium-RELEASE</reactor.version>
31-
<rsocket.version>1.0.0-RC5</rsocket.version>
32-
<metrics.version>3.1.2</metrics.version>
29+
<scalecube-config.version>0.4.4</scalecube-config.version>
30+
<reactor.version>Dysprosium-SR9</reactor.version>
31+
<rsocket.version>1.0.1</rsocket.version>
3332
<protostuff.version>1.6.0</protostuff.version>
34-
<netty.version>4.1.37.Final</netty.version>
35-
<reactor-netty.version>0.9.0.RELEASE</reactor-netty.version>
33+
<netty.version>4.1.50.Final</netty.version>
3634
<slf4j.version>1.7.30</slf4j.version>
37-
<log4j.version>2.11.0</log4j.version>
35+
<log4j.version>2.13.2</log4j.version>
3836
<disruptor.version>3.4.2</disruptor.version>
3937
<jsr305.version>3.0.2</jsr305.version>
4038
<jctools.version>2.1.2</jctools.version>
@@ -104,14 +102,12 @@
104102
</dependency>
105103
<dependency>
106104
<groupId>org.apache.logging.log4j</groupId>
107-
<artifactId>log4j-slf4j-impl</artifactId>
108-
<version>${log4j.version}</version>
109-
</dependency>
110-
<dependency>
111-
<groupId>org.apache.logging.log4j</groupId>
112-
<artifactId>log4j-core</artifactId>
105+
<artifactId>log4j-bom</artifactId>
113106
<version>${log4j.version}</version>
107+
<type>pom</type>
108+
<scope>import</scope>
114109
</dependency>
110+
115111
<!-- Disruptor -->
116112
<dependency>
117113
<groupId>com.lmax</groupId>
@@ -180,13 +176,6 @@
180176
<version>${scalecube-benchmarks.version}</version>
181177
</dependency>
182178

183-
<!-- Codahale -->
184-
<dependency>
185-
<groupId>io.dropwizard.metrics</groupId>
186-
<artifactId>metrics-core</artifactId>
187-
<version>${metrics.version}</version>
188-
</dependency>
189-
190179
<!-- JCTools -->
191180
<dependency>
192181
<groupId>org.jctools</groupId>

services-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.scalecube</groupId>
88
<artifactId>scalecube-services-parent</artifactId>
9-
<version>2.9.1-SNAPSHOT</version>
9+
<version>2.10.0-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>scalecube-services-api</artifactId>

services-api/src/main/java/io/scalecube/services/Reflect.java

Lines changed: 16 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
import io.scalecube.services.annotations.Tag;
1313
import io.scalecube.services.api.Qualifier;
1414
import io.scalecube.services.api.ServiceMessage;
15-
import io.scalecube.services.auth.Auth;
16-
import io.scalecube.services.auth.Principal;
15+
import io.scalecube.services.auth.Secured;
1716
import io.scalecube.services.methods.MethodInfo;
1817
import java.lang.reflect.Method;
19-
import java.lang.reflect.Parameter;
2018
import java.lang.reflect.ParameterizedType;
2119
import java.lang.reflect.Type;
2220
import java.util.Arrays;
@@ -93,10 +91,6 @@ public static Class<?> requestType(Method method) {
9391
if (method.isAnnotationPresent(RequestType.class)) {
9492
return method.getAnnotation(RequestType.class).value();
9593
} else {
96-
if (method.getParameters()[0].isAnnotationPresent(Principal.class)) {
97-
return Void.TYPE;
98-
}
99-
10094
if (method.getGenericParameterTypes()[0] instanceof ParameterizedType) {
10195
try {
10296
return Class.forName(parameterizedRequestType(method).getTypeName());
@@ -157,17 +151,17 @@ public static Map<Method, MethodInfo> methodsInfo(Class<?> serviceInterface) {
157151
.collect(
158152
Collectors.toMap(
159153
Function.identity(),
160-
method1 ->
154+
method ->
161155
new MethodInfo(
162156
serviceName(serviceInterface),
163-
methodName(method1),
164-
parameterizedReturnType(method1),
165-
isReturnTypeServiceMessage(method1),
166-
communicationMode(method1),
167-
method1.getParameterCount(),
168-
requestType(method1),
169-
isRequestTypeServiceMessage(method1),
170-
isAuth(method1)))));
157+
methodName(method),
158+
parameterizedReturnType(method),
159+
isReturnTypeServiceMessage(method),
160+
communicationMode(method),
161+
method.getParameterCount(),
162+
requestType(method),
163+
isRequestTypeServiceMessage(method),
164+
isSecured(method)))));
171165
}
172166

173167
/**
@@ -290,10 +284,10 @@ public static void validateMethodOrThrow(Method method) {
290284

291285
validateResponseType(method);
292286
validateRequestType(method);
293-
validatePrincipalParameter(method);
294287

295-
if (method.getParameterCount() > 2) {
296-
throw new UnsupportedOperationException("Service method can accept maximum 2 parameters");
288+
if (method.getParameterCount() > 1) {
289+
throw new UnsupportedOperationException(
290+
"Service method can accept at maximum single parameter");
297291
}
298292
}
299293

@@ -321,31 +315,6 @@ private static void validateRequestType(Method method) {
321315
}
322316
}
323317

324-
private static void validatePrincipalParameter(Method method) {
325-
Parameter[] parameters = method.getParameters();
326-
327-
if (!isAuth(method)) {
328-
for (Parameter parameter : parameters) {
329-
if (parameter.isAnnotationPresent(Principal.class)) {
330-
throw new UnsupportedOperationException(
331-
"@Principal can be used only for parameter of @Auth method");
332-
}
333-
}
334-
}
335-
336-
if (method.getParameterCount() == 2) {
337-
if (parameters[0].isAnnotationPresent(Principal.class)) {
338-
throw new UnsupportedOperationException(
339-
"@Principal cannot be the first parameter on method with two parameters");
340-
}
341-
342-
if (!parameters[1].isAnnotationPresent(Principal.class)) {
343-
throw new UnsupportedOperationException(
344-
"The second parameter can be only @Principal (optional)");
345-
}
346-
}
347-
}
348-
349318
/**
350319
* This method is used to get catual {@link CommunicationMode} os service method.
351320
*
@@ -391,8 +360,8 @@ public static boolean isService(Class<?> type) {
391360
return type.isAnnotationPresent(Service.class);
392361
}
393362

394-
public static boolean isAuth(Method method) {
395-
return method.isAnnotationPresent(Auth.class)
396-
|| method.getDeclaringClass().isAnnotationPresent(Auth.class);
363+
public static boolean isSecured(Method method) {
364+
return method.isAnnotationPresent(Secured.class)
365+
|| method.getDeclaringClass().isAnnotationPresent(Secured.class);
397366
}
398367
}

0 commit comments

Comments
 (0)