Skip to content

Commit

Permalink
5.0.0 (#214)
Browse files Browse the repository at this point in the history
* #9 extensions management

* optimize imports

* #9 add test and simple refactoring

* #9 #208 #206

first working commands

* #9 #208 #206

fix module installation

* #9 #208 #206

update install/get command

* #209 cli command to reload host, not implemeted yet

* #209 eventbus unregsiter implemented

* #209 add annotations

* #209 reload theme

increase versions to 5.0.0 because of api changes

* update distribution build

* update distribution add readme

* update command response

* #209 make themefeature updateable

* #209 make theme in RequestContextFactory dynamic

* fix loading of theme properties

* check installed modules at start

* #209 fire reload event after host reloaded

* #9 add some success logging

* #206 remove module command

* remove theme command

* fix remove theme command

---------

Co-authored-by: Thorsten Marx <[email protected]>
  • Loading branch information
thmarx and Thorsten Marx authored Jun 13, 2024
1 parent 917e988 commit 5780f07
Show file tree
Hide file tree
Showing 82 changed files with 2,373 additions and 142 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ see wiki for more information: [wiki](https://github.com/thmarx/cms/wiki)

# changelog

## 5.0.0

* **BREAKING CHANGE** Introduce module registry [#205](https://github.com/thmarx/cms/issues/205)
* **BREAKING CHANGE** Reload host cli command [#209](https://github.com/thmarx/cms/issues/209)
* **FEATURE** Extension management [#9](https://github.com/thmarx/cms/issues/9)
* **FEATURE** Theme management [#208](https://github.com/thmarx/cms/issues/208)
* **FEATURE** Module managment [#206](https://github.com/thmarx/cms/issues/206)

### Highlights

The new cli commands to manage extension, module and themes



### Migration

The base distribution contains only the thymeleaf template engine module. If any other module is use it has to be installed via the command line:
e.q. `java -jar cms-server-5.0.0.jar module get pebble-module`

The reloading of a host requires to update the template engine. For this, every template engine must implemente a `void updateTheme (Theme theme)` method.

## 4.18.1

Missing hook methods for scripting added

## 4.18.0

* **FEATURE** Make RequestContext available in scripting [#201](https://github.com/thmarx/cms/issues/201)
Expand Down
2 changes: 1 addition & 1 deletion cms-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.github.thmarx.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>4.18.1</version>
<version>5.0.0</version>
</parent>
<artifactId>cms-api</artifactId>
<packaging>jar</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* #L%
*/

import com.github.thmarx.cms.api.SiteProperties;
import com.github.thmarx.cms.api.ServerProperties;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand All @@ -49,6 +47,14 @@ public static SiteProperties hostProperties (Path path) throws IOException {
return new SiteProperties(properties);
}

public static ThemeProperties themeProperties (Path path) throws IOException {
Map<String, Object> properties = Map.of();
if (Files.exists(path)) {
properties = new Yaml().load(Files.readString(path, StandardCharsets.UTF_8));
}
return new ThemeProperties(properties);
}

public static ServerProperties serverProperties (Path path) throws IOException {
Map<String, Object> properties = new Yaml().load(Files.readString(path, StandardCharsets.UTF_8));
return new ServerProperties(properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public ThemeProperties(final Map<String, Object> properties) {
super(properties);
}

public Double version() {
return (Double)properties.get("version");
}

public String templateEngine() {
return (String) getSubMap("template").get("engine");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public TaxonomyConfiguration load() throws IOException {
}

@Override
public void reload(final TaxonomyConfiguration config) throws IOException {
public void reload(TaxonomyConfiguration config) throws IOException {
var tempConfig = load();
config.getTaxonomies().clear();
config.getTaxonomies().putAll(tempConfig.getTaxonomies());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ public interface EventBus {
<T extends Event> void publish(final T event);

<T extends Event> void register(Class<T> eventClass, EventListener<T> listener);

public <T extends Event> void unregister(Class<T> eventClass, EventListener<T> listener);

public void unregister(EventListener listener);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.github.thmarx.cms.api.eventbus.events.lifecycle;

/*-
* #%L
* cms-server
* %%
* Copyright (C) 2023 Marx-Software
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import com.github.thmarx.cms.api.eventbus.Event;

/**
*
* @author t.marx
*/
public record HostReloadedEvent(String id) implements Event {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.github.thmarx.cms.api.eventbus.events.lifecycle;

/*-
* #%L
* cms-server
* %%
* Copyright (C) 2023 Marx-Software
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import com.github.thmarx.cms.api.eventbus.Event;

/**
*
* @author t.marx
*/
public record ReloadHostEvent(String host) implements Event {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.github.thmarx.cms.api.feature.features;

import com.github.thmarx.cms.api.feature.Feature;
import com.github.thmarx.cms.api.theme.Theme;
import lombok.AllArgsConstructor;

/*-
* #%L
* cms-api
Expand All @@ -22,13 +26,20 @@
* #L%
*/

import com.github.thmarx.cms.api.feature.Feature;
import com.github.thmarx.cms.api.theme.Theme;

/**
*
* @author t.marx
*/
public record ThemeFeature(Theme theme) implements Feature {
@AllArgsConstructor
public class ThemeFeature implements Feature {

private Theme theme;

public Theme theme () {
return theme;
}

public void updateTheme (Theme theme) {
this.theme = theme;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

import com.github.thmarx.cms.api.db.ContentNode;
import com.github.thmarx.cms.api.theme.Theme;
import java.io.IOException;
import java.nio.file.Path;
import java.util.HashMap;
Expand All @@ -37,6 +38,8 @@ public interface TemplateEngine {

public void invalidateCache();

void updateTheme (Theme theme);

String render(final String template, final TemplateEngine.Model model) throws IOException;

@RequiredArgsConstructor
Expand Down
2 changes: 1 addition & 1 deletion cms-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.github.thmarx.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>4.18.1</version>
<version>5.0.0</version>
</parent>
<artifactId>cms-auth</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion cms-content/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.github.thmarx.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>4.18.1</version>
<version>5.0.0</version>
</parent>
<artifactId>cms-content</artifactId>
<packaging>jar</packaging>
Expand Down
6 changes: 5 additions & 1 deletion cms-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.github.thmarx.cms</groupId>
<artifactId>cms-parent</artifactId>
<version>4.18.1</version>
<version>5.0.0</version>
</parent>
<artifactId>cms-extensions</artifactId>
<packaging>jar</packaging>
Expand Down Expand Up @@ -37,5 +37,9 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.github.thmarx.cms.extensions.repository;

/*-
* #%L
* cms-extensions
* %%
* Copyright (C) 2023 - 2024 Marx-Software
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/

import lombok.Data;

/**
*
* @author t.marx
*/
@Data
public class ExtensionInfo {

private String id;
private String version;
private String name;
private String description;
private String author;
private String url;
private String compatibility;
}
Loading

0 comments on commit 5780f07

Please sign in to comment.