[Dev] Config API

[Dev] Config API - #5 by IDragonfire
I misunderstand the gdoc table … sk planned to use: GitHub - lightbend/config: configuration library for JVM languages using HOCON files It is already shaded into Forge.

old Post:

@sk89q announced that they need help with some packages.
Today I want to talk about the “util.config” one.
#I want not talk about the format
I want to talk about the API and usage.
sk89q want a typesafe config system.
I prefer a annotation system, e.g. DragonAntiPvPLeaver/src/com/github/idragonfire/DragonAntiPvPLeaver/DAPL_Config.java at master · IDragonfire/DragonAntiPvPLeaver · GitHub
@Faithcaio created a similiar lib for that:
GitHub - CubeEngine/ReflecT: Typesafe serialization of data for Java

What did you think?

Persistence layer

In constrast to config stuff, also data must be stored …
What is with a default abstraction layer?
If we have a annotation based system we can introduce a general persistence layer and the config
system is build on top of it.

PR: Add config api by killjoy1221 · Pull Request #90 · SpongePowered/SpongeAPI · GitHub
Issue: http://issues.spongepowered.org/youtrack/issue/SPONGE-6

Play is a web application framework and not a persistence API. Play uses Ebeans by default.

+1 from me as I’m also a part of its development

Thanks, only worked with Bukkit Ebean and that was great :smiley:
(After I learned it^^)

ReflecT can in fact be used for more than just saving configurations
i also used it for de/serializing data for mongodb
https://github.com/CubeEngine/modules-extra/blob/master/bigdata/src/main/java/de/cubeisland/engine/module/bigdata/MongoDBCodec.java
or NBT
https://github.com/CubeEngine/core/blob/master/src/main/java/de/cubeisland/engine/core/config/codec/NBTCodec.java

For SQL i think jOOQ (GitHub - jOOQ/jOOQ: jOOQ is the best way to write SQL in Java) or smth. like Ebean is better

I misunderstand the gdoc table …
sk planned to use:

It is already shaded into Forge.

Has this been implemented yet?

I (or someone) needs to play with Typesafe Config to see if it can emulate convention with Bukkit plugins (file header, write back defaults, etc.).

I think with whatever Config that is implemented, we should make sure to support comments, that was a major flaw in Bukkit’s Yaml configs.

2 Likes

Yaml supports comments. Use # Here is my comment.

Yaml supports comments, yes, but with Bukkit, if you were to save the config or something of the sort, the comments, except for the ones in the header would be removed or pushed to the header.

1 Like

Ohh, that is annoying. Never tried it xD

Comments were possible,
you need only some extra stuff for it :wink:

My stand: Sponge Config System uses HOCON instead of YAML.

I think they are planning to use HCOON

Google fails when I google that :satellite:. And i don’t think this is where I am looking for xD: http://www.hcon.in/. Sorry I am pretty sure it is something but can’t find it :s.

My fault:

HOCON

Oh oke. And this is probaly the lib http://maven-repository.com/artifact/com.typesafe/config/1.2.0 we need to play with :smile:. Looks good.

Linked it already above AND in the start post: