Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
giampiero7 committed Jun 28, 2023
2 parents de950c1 + 5fd0da8 commit 0a13d66
Show file tree
Hide file tree
Showing 30 changed files with 324 additions and 491 deletions.
39 changes: 8 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>cc.sferalabs.sfera</groupId>
<artifactId>sfera</artifactId>
<version>1.3.10</version>

<version>1.7.0</version>
<name>Sfera</name>
<description>The Sfera Framework for Home/Building Automation and IoT Integration</description>
<url>http://www.sferalabs.cc/sfera</url>

<organization>
<name>Sfera Labs S.r.l.</name>
<url>http://www.sferalabs.cc</url>
</organization>

<inceptionYear>2015</inceptionYear>

<licenses>
<license>
<name>The GNU Lesser General Public License, Version 3</name>
<url>http://www.gnu.org/licenses/lgpl-3.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<latestDeployedVersion>1.3.7</latestDeployedVersion>
<jetty-version>9.4.7.v20170914</jetty-version>
<jetty-version>9.4.38.v20210224</jetty-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<distributionManagement>
<repository>
<id>sferalabs.cc</id>
Expand All @@ -41,7 +34,6 @@
<url>scp://sferalabs.cc/var/www/sfera.sferalabs/docs/sfera/</url>
</site>
</distributionManagement>

<reporting>
<plugins>
<plugin>
Expand All @@ -60,7 +52,6 @@
</reportSet>
</reportSets>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
Expand All @@ -77,7 +68,6 @@
</plugin>
</plugins>
</reporting>

<build>
<extensions>
<extension>
Expand All @@ -86,13 +76,11 @@
<version>3.3.4</version>
</extension>
</extensions>

<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -103,7 +91,6 @@
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand All @@ -117,11 +104,10 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -131,7 +117,6 @@
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
Expand All @@ -157,7 +142,6 @@
</descriptorRefs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand All @@ -178,7 +162,6 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand All @@ -193,7 +176,6 @@
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
Expand All @@ -213,7 +195,6 @@
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
Expand All @@ -236,7 +217,8 @@
<artifactId>log4j-core</artifactId>
<version>2.5</version>
</dependency>
<dependency><!-- Needed for HSQLDB -->
<dependency>
<!-- Needed for HSQLDB -->
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.5</version>
Expand Down Expand Up @@ -277,9 +259,9 @@
<version>${jetty-version}</version>
</dependency>
<dependency>
<groupId>org.scream3r</groupId>
<groupId>io.github.java-native</groupId>
<artifactId>jssc</artifactId>
<version>2.8.0</version>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
Expand All @@ -289,12 +271,7 @@
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools-javadoc</artifactId>
<version>3.4</version>
<version>2.5.1</version>
</dependency>
</dependencies>
</project>
11 changes: 9 additions & 2 deletions src/main/java/cc/sferalabs/sfera/core/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,15 @@ public <T> T loadAs(Class<T> clazz) throws IOException {
if (path == null && config == null) {
return null;
}
CustomClassLoaderConstructor constr = new CustomClassLoaderConstructor(clazz.getClassLoader());
Yaml yaml = new Yaml(constr);

Yaml yaml;
ClassLoader cl = clazz.getClassLoader();
if (cl == null) {
yaml = new Yaml();
} else {
CustomClassLoaderConstructor constr = new CustomClassLoaderConstructor(cl);
yaml = new Yaml(constr);
}

if (path == null) {
return yaml.loadAs(yaml.dumpAsMap(config), clazz);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cc/sferalabs/sfera/core/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public class Plugin {
if (event.isCharacters()) {
description = event.asCharacters().getData();
}
} else if (description == null && elName.equals("version")) {
} else if (version == null && elName.equals("version")) {
event = eventReader.nextEvent();
if (event.isCharacters()) {
version = event.asCharacters().getData();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cc/sferalabs/sfera/core/Plugins.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private static void doLoad() {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(DIR_PATH))) {
for (Path file : stream) {
try {
logger.info("Loading plugin file '{}'", file);
if (!Files.isHidden(file)) {
Plugin p = new Plugin(file);
plugins.put(p.getId(), p);
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/cc/sferalabs/sfera/core/Sfera.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

package cc.sferalabs.sfera.core;

import java.security.Security;

import cc.sferalabs.sfera.logging.LoggerUtils;

/**
Expand Down Expand Up @@ -49,6 +51,8 @@ public class Sfera {
*/
public static void main(String[] args) {
System.setProperty("java.awt.headless", "true");
Security.setProperty("networkaddress.cache.ttl", "30");
Security.setProperty("networkaddress.cache.negative.ttl", "10");
LoggerUtils.init();
Thread.setDefaultUncaughtExceptionHandler(new SystemExceptionHandler());
SystemNode.getInstance().start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@ public class SystemExceptionHandler implements UncaughtExceptionHandler {
@Override
public void uncaughtException(Thread t, Throwable e) {
logger.error("Uncaught exception in thread: " + t.getName(), e);
if (e instanceof OutOfMemoryError) {
logger.warn("JVM memory: {}/{}", Runtime.getRuntime().freeMemory(), Runtime.getRuntime().totalMemory());
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/cc/sferalabs/sfera/core/SystemNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ protected void execute() {
} catch (InterruptedException e) {
}

logger.info("Quitted");
logger.warn("Quitted");

} finally {
System.exit(0);
Expand Down
105 changes: 0 additions & 105 deletions src/main/java/cc/sferalabs/sfera/doc/taglets/BaseTaglet.java

This file was deleted.

Loading

0 comments on commit 0a13d66

Please sign in to comment.