Skip to content

Commit f28b342

Browse files
committed
Moves ConsoleEchoServer to new module cmds [fix]
1 parent ff510fd commit f28b342

File tree

5 files changed

+176
-7
lines changed

5 files changed

+176
-7
lines changed

README.markdown

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,25 @@ You should hear the sounds change.
153153
To see what messages the UI is sending, just look in the PD window or
154154
in the terminal.
155155

156+
### Run the OSH Echo Server
157+
158+
This tool simple listens on `0.0.0.0`,
159+
and returns every OSC message it gets, as-is.
160+
161+
Before running -
162+
and every time the sources change -
163+
run this once:
164+
165+
```bash
166+
mvn install
167+
```
168+
169+
Then to run, simply execute:
170+
171+
```bash
172+
mvn --projects modules/cmds exec:java
173+
```
174+
156175
### Use the library
157176

158177
The classes that deal with sending OSC data

modules/cmds/pom.xml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2024 Robin Vobruba <hoijui.quaero@gmail.com>
3+
4+
SPDX-License-Identifier: Unlicense
5+
-->
6+
7+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
8+
<modelVersion>4.0.0</modelVersion>
9+
10+
<properties>
11+
<project.packageName>com.illposed.osc.cmds</project.packageName>
12+
<supported.osc.version>1.0</supported.osc.version>
13+
<project.mainClass>${project.packageName}.ConsoleEchoServer</project.mainClass>
14+
</properties>
15+
16+
<parent>
17+
<groupId>com.illposed.osc</groupId>
18+
<artifactId>javaosc-parent</artifactId>
19+
<version>0.10-SNAPSHOT</version>
20+
<relativePath>../parent</relativePath>
21+
</parent>
22+
23+
<artifactId>javaosc-cmds</artifactId>
24+
<version>0.10-SNAPSHOT</version>
25+
26+
<packaging>jar</packaging>
27+
28+
<name>JavaOSC-Commands</name>
29+
<description>An Open Sound Control library implementation in Java - Commands</description>
30+
31+
<build>
32+
<defaultGoal>package</defaultGoal>
33+
34+
<plugins>
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-jar-plugin</artifactId>
38+
<configuration>
39+
<archive>
40+
<manifest>
41+
<addClasspath>true</addClasspath>
42+
<classpathPrefix>dependency</classpathPrefix>
43+
<packageName>${project.packageName}</packageName>
44+
<mainClass>${project.mainClass}</mainClass>
45+
</manifest>
46+
</archive>
47+
</configuration>
48+
</plugin>
49+
50+
<!--
51+
This generates an extra jar file that can be run standalone.
52+
-->
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-assembly-plugin</artifactId>
56+
<configuration>
57+
<descriptorRefs>
58+
<descriptorRef>jar-with-dependencies</descriptorRef>
59+
</descriptorRefs>
60+
<archive>
61+
<manifest>
62+
<mainClass>${project.mainClass}</mainClass>
63+
</manifest>
64+
</archive>
65+
</configuration>
66+
</plugin>
67+
68+
<plugin>
69+
<groupId>org.codehaus.mojo</groupId>
70+
<artifactId>exec-maven-plugin</artifactId>
71+
<configuration>
72+
<mainClass>${project.mainClass}</mainClass>
73+
</configuration>
74+
</plugin>
75+
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-checkstyle-plugin</artifactId>
79+
<executions>
80+
<execution>
81+
<goals>
82+
<!-- Execute during the maven "verify" phase (`mvn verify`) -->
83+
<goal>check</goal>
84+
</goals>
85+
</execution>
86+
</executions>
87+
</plugin>
88+
89+
<!-- <plugin>
90+
<groupId>org.apache.maven.plugins</groupId>
91+
<artifactId>maven-pmd-plugin</artifactId>
92+
<executions>
93+
<execution>
94+
<goals> -->
95+
<!-- Execute during the maven "verify" phase (`mvn verify`) -->
96+
<!-- <goal>check</goal> -->
97+
<!-- </goals>
98+
</execution>
99+
</executions>
100+
<configuration>
101+
<excludes>
102+
<exclude>com/illposed/osc/OSCSerializer.java</exclude>
103+
<exclude>com/illposed/osc/argument/ArgumentHandler.java</exclude>
104+
<exclude>com/illposed/osc/messageselector/OSCPatternAddressMessageSelector.java</exclude>
105+
</excludes>
106+
</configuration>
107+
</plugin> -->
108+
109+
<plugin>
110+
<groupId>com.github.spotbugs</groupId>
111+
<artifactId>spotbugs-maven-plugin</artifactId>
112+
<executions>
113+
<execution>
114+
<goals>
115+
<!-- Execute during the maven "verify" phase (`mvn verify`) -->
116+
<!-- <goal>check</goal> -->
117+
</goals>
118+
</execution>
119+
</executions>
120+
</plugin>
121+
</plugins>
122+
</build>
123+
124+
<dependencies>
125+
<dependency>
126+
<groupId>com.illposed.osc</groupId>
127+
<artifactId>javaosc-core</artifactId>
128+
<version>0.10-SNAPSHOT</version>
129+
</dependency>
130+
<dependency>
131+
<groupId>org.slf4j</groupId>
132+
<artifactId>slf4j-simple</artifactId>
133+
<scope>runtime</scope>
134+
</dependency>
135+
</dependencies>
136+
137+
</project>
138+

modules/core/src/main/java/com/illposed/osc/ConsoleEchoServer.java renamed to modules/cmds/src/main/java/com/illposed/osc/cmds/ConsoleEchoServer.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// SPDX-FileCopyrightText: 2017 C. Ramakrishnan / Illposed Software
2-
// SPDX-FileCopyrightText: 2021 Robin Vobruba <hoijui.quaero@gmail.com>
2+
// SPDX-FileCopyrightText: 2021-2024 Robin Vobruba <hoijui.quaero@gmail.com>
33
//
44
// SPDX-License-Identifier: BSD-3-Clause
55

6-
package com.illposed.osc;
6+
package com.illposed.osc.cmds;
77

8+
import com.illposed.osc.EchoOSCMessageListener;
9+
import com.illposed.osc.OSCBadDataEvent;
10+
import com.illposed.osc.OSCBadDataListener;
11+
import com.illposed.osc.OSCMessageListener;
812
import com.illposed.osc.messageselector.JavaRegexAddressMessageSelector;
913
import com.illposed.osc.transport.OSCPortIn;
1014
import org.slf4j.Logger;
@@ -30,8 +34,6 @@ public class ConsoleEchoServer extends OSCPortIn {
3034
private static final int ARG_INDEX_ADDRESS = 0;
3135
private static final int ARG_INDEX_PORT = 1;
3236

33-
private static final Logger LOG = LoggerFactory.getLogger(ConsoleEchoServer.class);
34-
3537
private final Logger log;
3638

3739
private final class PrintBadDataListener implements OSCBadDataListener {
@@ -80,7 +82,7 @@ public void start() {
8082

8183
// Public API
8284
@SuppressWarnings("WeakerAccess")
83-
public static SocketAddress parseServerAddress(final String[] args)
85+
public static SocketAddress parseServerAddress(final Logger log, final String[] args)
8486
throws UnknownHostException
8587
{
8688
final InetAddress host;
@@ -92,7 +94,7 @@ public static SocketAddress parseServerAddress(final String[] args)
9294
try {
9395
port = Integer.parseInt(args[ARG_INDEX_PORT]);
9496
} catch (final NumberFormatException ex) {
95-
LOG.error("# ERROR: Invalid port: {}", args[ARG_INDEX_PORT]);
97+
log.error("# ERROR: Invalid port: {}", args[ARG_INDEX_PORT]);
9698
throw ex;
9799
}
98100
}
@@ -104,6 +106,7 @@ public static SocketAddress parseServerAddress(final String[] args)
104106
}
105107

106108
public static void main(final String[] args) throws IOException {
107-
new ConsoleEchoServer(parseServerAddress(args), LoggerFactory.getLogger(ConsoleEchoServer.class)).start();
109+
final Logger log = LoggerFactory.getLogger(ConsoleEchoServer.class);
110+
new ConsoleEchoServer(parseServerAddress(log, args), log).start();
108111
}
109112
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-FileCopyrightText: 2024 Robin Vobruba <hoijui.quaero@gmail.com>
2+
//
3+
// SPDX-License-Identifier: BSD-3-Clause
4+
5+
/**
6+
* Provides directly runnable sofwtare, using the core package.
7+
*/
8+
package com.illposed.osc.cmds;

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ SPDX-License-Identifier: Unlicense
3838
<!-- We also need the parent here, for its SNAPSHOTs to be deployed. -->
3939
<module>modules/parent</module>
4040
<module>modules/core</module>
41+
<module>modules/cmds</module>
4142
<module>modules/ui</module>
4243
<module>modules/java-se-addons</module>
4344
</modules>

0 commit comments

Comments
 (0)