Skip to content

Commit aaaf3ac

Browse files
authored
Add encon databind (#2)
Add encon-databind module
1 parent d9d1730 commit aaaf3ac

File tree

205 files changed

+6595
-2695
lines changed

Some content is hidden

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

205 files changed

+6595
-2695
lines changed

.codestyle/checkstyle.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ limitations under the License.
9090
<module name="SummaryJavadoc">
9191
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
9292
</module>
93-
<module name="JavadocParagraph"/>
9493
<module name="SingleLineJavadoc">
9594
<property name="ignoreInlineTags" value="false"/>
9695
</module>

.codestyle/pmd.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ limitations under the License.
2424
<description>PMD Rules</description>
2525

2626
<rule ref="category/java/bestpractices.xml">
27+
<exclude name="UseVarargs" />
2728
</rule>
2829
<rule ref="category/java/codestyle.xml">
2930
<exclude name="AbstractNaming" />
3031
<exclude name="AtLeastOneConstructor" />
3132
<exclude name="AvoidPrefixingMethodParameters" />
33+
<exclude name="ClassNamingConventions" />
3234
<exclude name="CommentDefaultAccessModifier" />
3335
<exclude name="DefaultPackage" />
3436
<exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
@@ -71,6 +73,7 @@ limitations under the License.
7173
<exclude name="MissingBreakInSwitch" />
7274
</rule>
7375
<rule ref="category/java/multithreading.xml">
76+
<exclude name="UseConcurrentHashMap" />
7477
</rule>
7578
<rule ref="category/java/performance.xml">
7679
<exclude name="AvoidUsingShortType" />

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ deploy:
4040
- "encon-terms/target/encon-terms-$project_version.jar"
4141
- "encon-terms/target/encon-terms-$project_version-javadoc.jar"
4242
- "encon-terms/target/encon-terms-$project_version-sources.jar"
43+
- "encon-config/target/encon-config-$project_version.jar"
44+
- "encon-config/target/encon-config-$project_version-javadoc.jar"
45+
- "encon-config/target/encon-config-$project_version-sources.jar"
46+
- "encon-databind/target/encon-databind-$project_version.jar"
47+
- "encon-databind/target/encon-databind-$project_version-javadoc.jar"
48+
- "encon-databind/target/encon-databind-$project_version-sources.jar"
4349
- "encon/target/encon-$project_version.jar"
4450
- "encon/target/encon-$project_version-javadoc.jar"
4551
- "encon/target/encon-$project_version-sources.jar"

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
- Provide more custom exceptions.
1515
- Review debug logs.
1616
- Add `monitor` functionality.
17-
- Make receive/handler approaches in `mailbox` mutually exclusive.
1817
- Add tests.
1918
- Split `protocol`, `module` and `config` on separate sub-projects.
2019
- Rething caches in terms ans modules.
20+
- Add lazy deserialization for terms.
21+
22+
## [1.1.0](https://github.com/appulse-projects/encon-java/releases/tag/1.1.0) - 2018-06-19
23+
24+
Small refactoring and cleaning.
25+
26+
### Added
27+
28+
- Make receive/handler approaches in `mailbox` mutually exclusive.
29+
- JavaDocs.
30+
31+
### Changed
32+
33+
- Small refactoring.
2134

2235
## [1.0.0](https://github.com/appulse-projects/encon-java/releases/tag/1.0.0) - 2018-05-01
2336

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Overview
22

33
[![build_status](https://travis-ci.org/appulse-projects/encon-java.svg?branch=master)](https://travis-ci.org/appulse-projects/encon-java)
4-
[![maven_central](https://maven-badges.herokuapp.com/maven-central/io.appulse/encon-java/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.appulse/encon-java)
4+
[![maven_central](https://maven-badges.herokuapp.com/maven-central/io.appulse.encon/encon/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.appulse.encon/encon)
55

66
Java implementation of Erlang node connector (distribution protocol).
77

8+
Sub-modules descriptions:
9+
10+
- [Encon common](./encon-common/README.md)
11+
- [Encon terms](./encon-terms/README.md)
12+
- [Encon config](./encon-config/README.md)
13+
- [Encon](./encon/README.md)
14+
- [Encon databind](./encon-databind/README.md)
15+
816
## Development
917

1018
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

encon-common/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Overview
2+
3+
Encon's common classes for all subprojects.

encon-common/pom.xml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,69 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Copyright 2018 the original author or authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
219
<project xmlns="http://maven.apache.org/POM/4.0.0"
320
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
421
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
522

623
<modelVersion>4.0.0</modelVersion>
724

825
<parent>
9-
<groupId>io.appulse.encon.java</groupId>
26+
<groupId>io.appulse.encon</groupId>
1027
<artifactId>encon-parent</artifactId>
11-
<version>1.0.0</version>
28+
<version>1.1.0</version>
1229
</parent>
1330

1431
<artifactId>encon-common</artifactId>
1532
<packaging>jar</packaging>
1633

1734
<dependencies>
35+
<dependency>
36+
<groupId>org.projectlombok</groupId>
37+
<artifactId>lombok</artifactId>
38+
<scope>provided</scope>
39+
</dependency>
40+
1841
<dependency>
1942
<groupId>io.appulse.epmd.java</groupId>
2043
<artifactId>core</artifactId>
2144
</dependency>
45+
46+
<dependency>
47+
<groupId>com.google.code.findbugs</groupId>
48+
<artifactId>annotations</artifactId>
49+
<scope>provided</scope>
50+
</dependency>
51+
<dependency>
52+
<groupId>com.google.code.findbugs</groupId>
53+
<artifactId>jsr305</artifactId>
54+
<scope>provided</scope>
55+
</dependency>
56+
57+
<dependency>
58+
<groupId>junit</groupId>
59+
<artifactId>junit</artifactId>
60+
<scope>test</scope>
61+
</dependency>
62+
<dependency>
63+
<groupId>org.assertj</groupId>
64+
<artifactId>assertj-core</artifactId>
65+
<scope>test</scope>
66+
</dependency>
2267
</dependencies>
2368

2469
<build>
Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
/*
2+
* Copyright 2018 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.appulse.encon.common;
18+
19+
import static java.util.stream.Collectors.toSet;
20+
import static lombok.AccessLevel.PRIVATE;
21+
22+
import java.util.Collection;
23+
import java.util.Set;
24+
import java.util.stream.Stream;
25+
26+
import lombok.Getter;
27+
import lombok.experimental.FieldDefaults;
28+
29+
/**
30+
* Enumeration of all available distribution capability flags.
31+
*
32+
* @since 1.0.0
33+
* @author Artem Labazin
34+
*/
35+
@FieldDefaults(level = PRIVATE, makeFinal = true)
36+
public enum DistributionFlag {
37+
38+
/**
39+
* The node is to be published and part of the global namespace.
40+
*/
41+
PUBLISHED(1),
42+
43+
/**
44+
* The node implements an atom cache (obsolete).
45+
*/
46+
ATOM_CACHE(2),
47+
48+
/**
49+
* The node implements extended (3 × 32 bits) references.
50+
* This is required today. If not present, the connection is refused.
51+
*/
52+
EXTENDED_REFERENCES(4),
53+
54+
/**
55+
* The node implements distributed process monitoring.
56+
*/
57+
DIST_MONITOR(8),
58+
59+
/**
60+
* The node uses separate tag for functions (lambdas) in the distribution protocol.
61+
*/
62+
FUN_TAGS(0x10),
63+
64+
/**
65+
* The node implements distributed named process monitoring.
66+
* <p>
67+
* Not used.
68+
*/
69+
DIST_MONITOR_NAME(0x20),
70+
71+
/**
72+
* The (hidden) node implements atom cache (obsolete).
73+
* <p>
74+
* Not supported.
75+
*/
76+
HIDDEN_ATOM_CACHE(0x40),
77+
78+
/**
79+
* The node understand new function tags.
80+
*/
81+
NEW_FUN_TAGS(0x80),
82+
83+
/**
84+
* The node can handle extended pids and ports. This is required today.
85+
* If not present, the connection is refused.
86+
*/
87+
EXTENDED_PIDS_PORTS(0x100),
88+
89+
/**
90+
* Unknown and not supported tag...
91+
*/
92+
EXPORT_PTR_TAG(0x200),
93+
94+
/**
95+
* The node supports bit binaries.
96+
*/
97+
BIT_BINARIES(0x400),
98+
99+
/**
100+
* The node understands new float format.
101+
*/
102+
NEW_FLOATS(0x800),
103+
104+
/**
105+
* The node supports UTF IO.
106+
*/
107+
UNICODE_IO(0x1000),
108+
109+
/**
110+
* The node implements atom cache in distribution header.
111+
*/
112+
DIST_HDR_ATOM_CACHE(0x2000),
113+
114+
/**
115+
* The node understand the SMALL_ATOM_EXT tag.
116+
*/
117+
SMALL_ATOM_TAGS(0x4000),
118+
119+
/**
120+
* The node understand UTF-8 encoded atoms.
121+
*/
122+
UTF8_ATOMS(0x10000),
123+
124+
/**
125+
* The node supports map data types.
126+
*/
127+
MAP_TAG(0x20000),
128+
129+
/**
130+
* The node creation is big integer.
131+
*/
132+
BIG_CREATION(0x40000);
133+
134+
@Getter
135+
int code;
136+
137+
DistributionFlag (int code) {
138+
this.code = code;
139+
}
140+
141+
/**
142+
* Converts set of distribution flags to integer number
143+
* via bitwise inclusive OR operator.
144+
*
145+
* @param flags set of distribution flags
146+
*
147+
* @return integer representation of flags
148+
*/
149+
public static int bitwiseOr (DistributionFlag... flags) {
150+
return Stream.of(flags)
151+
.map(DistributionFlag::getCode)
152+
.reduce(0, (left, right) -> left | right);
153+
}
154+
155+
/**
156+
* Converts set of distribution flags to integer number
157+
* via bitwise inclusive OR operator.
158+
*
159+
* @param flags set of distribution flags
160+
*
161+
* @return integer representation of flags
162+
*/
163+
public static int bitwiseOr (Collection<DistributionFlag> flags) {
164+
return flags.stream()
165+
.map(DistributionFlag::getCode)
166+
.reduce(0, (left, right) -> left | right);
167+
}
168+
169+
/**
170+
* Parses integer to set of distribution flags via bitwise AND operation.
171+
*
172+
* @param number represents a set of distribution flags
173+
*
174+
* @return set of parsed distribution flags
175+
*/
176+
public static Set<DistributionFlag> parse (int number) {
177+
return Stream.of(values())
178+
.filter(it -> (number & it.getCode()) != 0)
179+
.collect(toSet());
180+
}
181+
}

encon-common/src/main/java/io/appulse/encon/java/common/Meta.java renamed to encon-common/src/main/java/io/appulse/encon/common/Meta.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.appulse.encon.java.common;
17+
package io.appulse.encon.common;
1818

1919
import java.util.Set;
2020

@@ -27,9 +27,10 @@
2727
import lombok.Value;
2828

2929
/**
30+
* Node's meta information description.
3031
*
31-
* @author Artem Labazin
3232
* @since 1.0.0
33+
* @author Artem Labazin
3334
*/
3435
@Value
3536
@Builder

0 commit comments

Comments
 (0)