-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
137 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
hagrid-api/src/main/java/dev/volix/rewinside/odyssey/hagrid/HagridService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
hagrid-api/src/main/java/dev/volix/rewinside/odyssey/hagrid/config/PropertiesConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package dev.volix.rewinside.odyssey.hagrid.config; | ||
|
||
import java.util.Properties; | ||
|
||
/** | ||
* @author Tobias Büser | ||
*/ | ||
public class PropertiesConfig { | ||
|
||
private final Properties properties; | ||
|
||
public PropertiesConfig(final Properties properties) { | ||
this.properties = properties; | ||
} | ||
|
||
public <V> V get(final String key) { | ||
if (!this.properties.contains(key)) { | ||
throw new IllegalArgumentException(String.format("unknown configuration for key '%s'", key)); | ||
} | ||
|
||
return (V) this.properties.get(key); | ||
} | ||
|
||
public String getString(final String key) { | ||
return this.get(key); | ||
} | ||
|
||
public int getInt(final String key) { | ||
return this.get(key); | ||
} | ||
|
||
public double getDouble(final String key) { | ||
return this.get(key); | ||
} | ||
|
||
public boolean getBoolean(final String key) { | ||
return this.get(key); | ||
} | ||
|
||
public Properties getProperties() { | ||
return this.properties; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
hagrid-core/src/main/java/dev/volix/rewinside/odyssey/hagrid/HagridConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dev.volix.rewinside.odyssey.hagrid; | ||
|
||
import dev.volix.rewinside.odyssey.hagrid.config.PropertiesConfig; | ||
import java.util.Properties; | ||
|
||
/** | ||
* @author Tobias Büser | ||
*/ | ||
public class HagridConfig extends PropertiesConfig { | ||
|
||
public static final String MAX_SUBSCRIBER = "downstream.max_subscriber"; | ||
public static final String LISTENER_CLEANUP_DELAY_IN_SECONDS = "listener.cleanup.delay"; | ||
public static final String RECONNECT_DELAY_IN_SECONDS = "connection.reconnect.delay"; | ||
|
||
public HagridConfig(final Properties properties) { | ||
super(properties); | ||
|
||
properties.putIfAbsent(MAX_SUBSCRIBER, 10); | ||
properties.putIfAbsent(LISTENER_CLEANUP_DELAY_IN_SECONDS, 2); | ||
properties.putIfAbsent(RECONNECT_DELAY_IN_SECONDS, 10); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters