Skip to content

Commit

Permalink
Issue #132: Add method for checking if the log service has already be…
Browse files Browse the repository at this point in the history
…en started

Signed-off-by: Rafael Luis Ibasco <[email protected]>
  • Loading branch information
ribasco committed Dec 3, 2022
1 parent 9233454 commit 869189e
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 89 deletions.
14 changes: 14 additions & 0 deletions .run/Source Log Listener.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Source Log Listener" type="Application" factoryName="Application" folderName="Examples">
<option name="ALTERNATIVE_JRE_PATH" value="temurin-1.8" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.ibasco.agql.examples.base.ExampleRunner" />
<module name="agql-lib-examples" />
<option name="PROGRAM_PARAMETERS" value="-e source-log" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
14 changes: 14 additions & 0 deletions .run/Source Rcon.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Source Rcon" type="Application" factoryName="Application" folderName="Examples">
<option name="ALTERNATIVE_JRE_PATH" value="temurin-1.8" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.ibasco.agql.examples.base.ExampleRunner" />
<module name="agql-lib-examples" />
<option name="PROGRAM_PARAMETERS" value="-e source-rcon" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
14 changes: 14 additions & 0 deletions .run/Source Server Queries.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Source Server Queries" type="Application" factoryName="Application" folderName="Examples">
<option name="ALTERNATIVE_JRE_PATH" value="temurin-1.8" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.ibasco.agql.examples.base.ExampleRunner" />
<module name="agql-lib-examples" />
<option name="PROGRAM_PARAMETERS" value="-e source-query" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Changelog
-------------
1.1.0 - Bug fixes/enhancements

- Enhancement #132: (source-log) Add method for checking if the log service has already been started

1.0.8 - Bump dependency version

1.0.7 - Bug fixes/enhancements

- Bug #106: Game Server Port should be read as unsigned Short
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -251,7 +251,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-steam-master</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -261,7 +261,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-source-query</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -272,7 +272,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-source-log</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -282,7 +282,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-source-rcon</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -292,7 +292,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-steam-webapi</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -302,7 +302,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-dota2-webapi</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -312,7 +312,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-csgo-webapi</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand All @@ -324,7 +324,7 @@ Just add the following dependencies to your maven pom.xml. Only include the modu
<dependency>
<groupId>com.ibasco.agql</groupId>
<artifactId>agql-coc-webapi</artifactId>
<version>1.0.8</version>
<version>1.1.0</version>
</dependency>
```

Expand Down
40 changes: 2 additions & 38 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,6 @@
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<skip>true</skip>
<!--<archive>
<index>true</index>
<manifest>
<mainClass>com.ibasco.agql.examples.base.ExampleRunner</mainClass>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<mode>development</mode>
<url>${project.url}</url>
</manifestEntries>
</archive>-->
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -141,7 +130,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.5</version>
<version>1.3.3</version> <!-- do not upgrade to 1.4 -->
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
Expand All @@ -151,37 +140,12 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.5</version>
<version>1.3.3</version> <!-- do not upgrade to 1.4 -->
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
</dependency>
<!--<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>3.21.0</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal</artifactId>
<version>3.21.0</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-reader</artifactId>
<version>3.21.0</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-jansi</artifactId>
<version>3.21.0</version>
</dependency>-->
<!--<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>2.4.0</version>
</dependency>-->
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import com.ibasco.agql.examples.base.BaseExample;
import com.ibasco.agql.protocols.valve.source.query.logger.SourceLogEntry;
import com.ibasco.agql.protocols.valve.source.query.logger.SourceLogListenService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.concurrent.CompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* <p>SourceLogListenerExample class.</p>
Expand All @@ -41,8 +42,11 @@ public class SourceLogListenerExample extends BaseExample {
public void run(String[] args) throws Exception {
String address = promptInput("Please enter server address to listen on: ", true, null, "listenAddress");
int port = promptInputInt("Please enter the server port (default: 27500) : ", false, "27500");
logService = new SourceLogListenService(new InetSocketAddress(address, port), SourceLogListenerExample::processLogData);
InetSocketAddress listenAddress = new InetSocketAddress(address, port);
logService = new SourceLogListenService(listenAddress, SourceLogListenerExample::processLogData);
CompletableFuture<Void> f = logService.listen();
System.out.printf("Listening on %s (listening: %s, future: %s)", listenAddress, logService.isListening(), logService.getListenFuture());
assert logService.isListening();
f.join();
System.out.println("Log service has been closed");
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<!-- Properties -->
<properties>
<revision>1.0.8</revision>
<revision>1.1.0</revision>
<changelist>-SNAPSHOT</changelist>
<sha1/>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Loading

0 comments on commit 869189e

Please sign in to comment.