M .gitignore => .gitignore +4 -0
@@ 1,3 1,7 @@
*.swp
bin/
target/
+.classpath
+.factorypath
+.project
+.settings
M README.md => README.md +8 -5
@@ 1,16 1,19 @@
+![License:](https://git.sr.ht/~skiqqy/specCosmic/blob/master/assets/logo.png)
+
# libCosmic
-> Short intro here
+> Lib for interacting with cosmic web server
## Installing
-## Usage
-
-> Simply run:
```
-$
+$ mvn install
```
+## Usage
+
+include in the class path of the app that wants to use it.
+
## Notes
[![License:](https://img.shields.io/badge/license-LGPL3-green)](https://www.gnu.org/licenses/lgpl-3.0.txt)
M pom.xml => pom.xml +11 -3
@@ 23,6 23,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
+ <spring.version>6.0.5</spring.version>
</properties>
<dependencies>
@@ 34,9 35,9 @@
</dependency>
<dependency>
- <groupId>xyz.skiqqy.jopts</groupId>
- <artifactId>jopts</artifactId>
- <version>2.0.0</version>
+ <groupId>xyz.skiqqy.comfy</groupId>
+ <artifactId>comfy</artifactId>
+ <version>1.1.0</version>
</dependency>
<dependency>
@@ 50,6 51,13 @@
<artifactId>log4j-core</artifactId>
<version>2.19.0</version>
</dependency>
+
+ <!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${spring.version}</version>
+ </dependency>
</dependencies>
<build>
D src/main/java/xyz/skiqqy/cosmic/lib/Main.java => src/main/java/xyz/skiqqy/cosmic/lib/Main.java +0 -17
@@ 1,17 0,0 @@
-package xyz.skiqqy.cosmic.lib;
-
-import xyz.skiqqy.jopts.JOpts;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.LogManager;
-
-public class Main {
- private static final Logger log = LogManager.getLogger(Main.class);
- public static void main(String... argv) {
- JOpts jo = new JOpts(new String[][] {
- new String[] {"h,-help", "Shows this message"}
- },
- argv
- );
- if (jo.is("h")) System.out.print(jo.usage());
- }
-}
A src/main/java/xyz/skiqqy/cosmic/lib/module/Module.java => src/main/java/xyz/skiqqy/cosmic/lib/module/Module.java +46 -0
@@ 0,0 1,46 @@
+package xyz.skiqqy.cosmic.lib.module;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import xyz.skiqqy.comfy.core.Conf;
+
+/* A "Module" is bean which takes a config used to build a restful web service
+* for some abstract java application.
+*
+* This annotation takes a single required value, namely the config class that
+* should be used to instantiate this object. Note, the config determins if
+* if only a single instance of the restful API is alowed (i.e the config
+* isSinguler == true), or in the later case, multiple may be created.
+*
+* The contract a class accepts when using this annotation is the following.
+*
+* 1. There can only be a single constructor, with 2 argument's:
+* - A xyz.skiqqy.comfy.core.Conf (or a subclass there off), specifically it
+* takes the type given to the annotation.
+* - A string, which is to be prepended to any paths (i.e the root url)
+*
+* 2. The constructor _must_ use the config to "init" the project, what ever
+* that means for said project. (For example, if database connections are
+* needed, these should be setup during the constructor call).
+* For all intents and purposes, the constructor "acts" like the call to Main
+* for that application, the restful methods to be implemented would
+* logically translate to optargs that would be used in calling said
+* application
+*
+* it may then implement methods and use the spring
+* @RequestMapping(method=RequestMethod.GET, path="/hello-world")
+* To provide a "restful" implementation of the application
+*
+*/
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+@RestController
+public @interface Module {
+ Class<? extends Conf> value();
+}