Comments (7)
The source passing is done in this function https://github.com/dma-ais/AisLib/blob/master/ais-lib-communication/src/main/java/dk/dma/ais/reader/AisReaders.java
Line 182-210.
There is a AisUdpReader class that can be used instead of AisTcpReader.
But there is not implemented any kind of functionality for parsing the command line parameters into a UDP reader.
But it should be fairly easy for you to modify that method to instantiate a AisUdpReader instead of a AisTcpReader. And just compile a new jar
from aisstore.
So, if I understand you correctly, we have to find that AisReaders.java file and change Tcp to Udp in the lines you have mentioned?
We have cloned the repository and installed it using mvn. That mvn install command provides us the jar that we can execute, correct? The AisReaders.java is not included in the AisStore-repository as far as I know, so how can I change Tcp to Udp before the jar is compiled? I have already installed a Java decompiler, but that doesn't allow me to change the file :(
from aisstore.
No reason to decompile anything.
Just change the line in AIS-LIB compile a new jar.
And build AisStore again.
You need to upgrade the reference in https://github.com/dma-ais/AisStore/blob/master/ais-store-common/pom.xml
to 2.3-SNAPSHOT from 2.2-SNAPSHOT
from aisstore.
There is just one thing I do not understand and that is how we edit that AisReaders file. We do not clone the AisLib repo, that is done automatically when we do mvn install
in the AisStore repository. Do we have to download AisLib ourself, change the line and then include that in AisStore?
I have never worked with Java before, so this is all new to me. I try to understand and search for things I might need, but I do not have found anything relevant for me.
from aisstore.
No problem
git clone [email protected]:dma-ais/AisLib.git
replace https://github.com/dma-ais/AisLib/blob/master/ais-lib-communication/src/main/java/dk/dma/ais/reader/AisReaders.java using your favorite editor
cd AisLib
mvn install
Git clone [email protected]:dma-ais/AisStore.git
upgrade reference to Ais Lib in You need to upgrade the reference in https://github.com/dma-ais/AisStore/blob/master/ais-store-common/pom.xml
to 2.3-SNAPSHOT from 2.2-SNAPSHOT
cd AisStore
mvn install
You should have a new executable jar in ais-store-cli/target
from aisstore.
Thanks for your reply! We will try to change the AisReaders file so it works with UDP today and I will let you know if it is successfull or not.
I really appreciate your support, I don't think we could fix it by myself!
from aisstore.
Alright, we have changed line 182-210 as following:
static AisUdpReader parseSource(String fullSource) {
try (Scanner s = new Scanner(fullSource);) {
s.useDelimiter("\s*=\s*");
if (!s.hasNext()) {
throw new IllegalArgumentException("Source must be of the format src=host:port,host:port, was "
+ fullSource);
}
String src = s.next();
if (!s.hasNext()) {
throw new IllegalArgumentException(
"A list of hostname:ports must follow the source (format src=host:port,host:port), was "
+ fullSource);
}
AisUdpReader r = new AisUdpReader();
try (Scanner s1 = new Scanner(s.next())) {
s1.useDelimiter("\s*,\s*");
if (!s1.hasNext()) {
throw new IllegalArgumentException(
"Source must have at least one host:port (format src=host:port,host:port), was "
+ fullSource);
}
while (s1.hasNext()) {
r.addHostPort(HostAndPort.fromString(s1.next()));
}
}
r.setSourceId(src);
return r;
}
}
After that, we have installed using Maven, mvn install
gave the following output (and errors :():
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] AIS Parent ......................................... SUCCESS [ 0.166 s]
[INFO] AIS Messages ....................................... SUCCESS [ 2.885 s]
[INFO] AIS Communication .................................. FAILURE [ 1.996 s]
[INFO] AIS utils .......................................... SKIPPED
[INFO] AisLib CLI ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.335 s
[INFO] Finished at: 2016-12-15T15:11:36+01:00
[INFO] Final Memory: 24M/388M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ais-lib-communication: Compilation failure: Compilation failure:
[ERROR] /root/AisLib/ais-lib-communication/src/main/java/dk/dma/ais/reader/AisReaders.java:[52,41] incompatible types: dk.dma.ais.reader.AisUdpReader cannot be converted to dk.dma.ais.reader.AisTcpReader
[ERROR] /root/AisLib/ais-lib-communication/src/main/java/dk/dma/ais/reader/AisReaders.java:[195,30] no suitable constructor found for AisUdpReader(no arguments)
[ERROR] constructor dk.dma.ais.reader.AisUdpReader.AisUdpReader(int) is not applicable
[ERROR] (actual and formal argument lists differ in length)
[ERROR] constructor dk.dma.ais.reader.AisUdpReader.AisUdpReader(java.lang.String,int) is not applicable
[ERROR] (actual and formal argument lists differ in length)
[ERROR] /root/AisLib/ais-lib-communication/src/main/java/dk/dma/ais/reader/AisReaders.java:[204,22] cannot find symbol
[ERROR] symbol: method addHostPort(com.google.common.net.HostAndPort)
[ERROR] location: variable r of type dk.dma.ais.reader.AisUdpReader
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :ais-lib-communication
Any idea how to fix this or did we miss something really important?
from aisstore.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aisstore.