Stuff! + HikariCP Log4J

This commit is contained in:
Gabriele C 2015-09-05 00:45:48 +02:00
parent 6545ad3aea
commit 1f66a7474d
31 changed files with 279 additions and 735 deletions

View File

@ -1,443 +0,0 @@
<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>com.zaxxer</groupId>
<artifactId>HikariCP-Log4j</artifactId>
<version>2.4.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>HikariCP-Log4J</name>
<description>Ultimate JDBC Connection Pool [Log4j Version]</description>
<url>https://github.com/brettwooldridge/HikariCP</url>
<organization>
<name>Zaxxer.com</name>
<url>https://github.com/brettwooldridge</url>
</organization>
<scm>
<connection>scm:git:git@github.com:brettwooldridge/HikariCP.git</connection>
<developerConnection>scm:git:git@github.com:brettwooldridge/HikariCP.git</developerConnection>
<url>git@github.com:brettwooldridge/HikariCP.git</url>
<tag>HEAD</tag>
</scm>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Brett Wooldridge</name>
<email>brett.wooldridge@gmail.com</email>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hibernate.version>4.3.9.Final</hibernate.version>
<javassist.version>3.18.2-GA</javassist.version>
<jndi.version>0.11.4.1</jndi.version>
<metrics.version>3.1.2</metrics.version>
<mockito.version>1.10.19</mockito.version>
<pax.exam.version>4.5.0</pax.exam.version>
<pax.url.version>2.4.1</pax.url.version>
<slf4j.version>1.7.12</slf4j.version>
<felix.bundle.plugin.version>2.5.3</felix.bundle.plugin.version>
<felix.version>5.0.0</felix.version>
<log4j.version>2.3</log4j.version>
</properties>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!--<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>${metrics.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-healthchecks</artifactId>
<version>${metrics.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>simple-jndi</groupId>
<artifactId>simple-jndi</artifactId>
<version>${jndi.version}</version>
<scope>test</scope>
</dependency>
<!-- OSGi test -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>${felix.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>${pax.url.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-reference</artifactId>
<version>${pax.url.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.name}-${project.version}</finalName>
<plugins>
<plugin>
<!-- Generate proxies -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<phase>compile</phase>
<!-- phase>generate-test-sources</phase -->
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.zaxxer.hikari.proxy.JavassistProxyFactory</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.4.201502262128</version>
<executions>
<!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as VM argument when Maven the Surefire plugin is executed. -->
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
<!-- Sets the name of the property containing the settings for JaCoCo runtime agent. -->
<propertyName>surefireArgLine</propertyName>
<excludes>
<exclude>**/com/zaxxer/hikari/proxy/**</exclude>
<exclude>**/com/zaxxer/hikari/metrics/**</exclude>
</excludes>
</configuration>
</execution>
<!-- Ensures that the code coverage report for unit tests is created after unit tests have been run. -->
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
<excludes>
<exclude>**/com/zaxxer/hikari/proxy/**</exclude>
<exclude>**/com/zaxxer/hikari/metrics/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${felix.bundle.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>HikariCP</Bundle-Name>
<Export-Package>
com.zaxxer.hikari,
com.zaxxer.hikari.hibernate,
com.zaxxer.hikari.metrics
</Export-Package>
<Private-Package>com.zaxxer.hikari.*</Private-Package>
<_exportcontents>
com.zaxxer.hikari.pool,
com.zaxxer.hikari.util,
com.zaxxer.hikari.proxy
</_exportcontents>
<Import-Package>
javax.management,
javax.naming,
javax.naming.spi,
javax.sql,
javax.sql.rowset,
javax.sql.rowset.serial,
javax.sql.rowset.spi,
com.codahale.metrics;resolution:=optional,
com.codahale.metrics.health;resolution:=optional,
org.slf4j;version="[1.6,2)",
org.hibernate;resolution:=optional,
org.hibernate.cfg;resolution:=optional,
org.hibernate.engine.jdbc.connections.spi;resolution:=optional,
org.hibernate.service;resolution:=optional,
org.hibernate.service.spi;resolution:=optional
</Import-Package>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
<executions>
<!-- This execution makes sure that the manifest is available when the tests are executed -->
<execution>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<extensions>true</extensions>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>HikariCP-@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<!-- Sets the VM argument line used when unit tests are run. -->
<argLine>${surefireArgLine}</argLine>
<!-- Skips unit tests if the value of skip.unit.tests property is true -->
<skipTests>${skip.unit.tests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<configuration>
<!-- outputDirectory>/absolute/path/to/the/output/directory</outputDirectory>
<finalName>filename-of-generated-jar-file</finalName -->
<attach>true</attach>
</configuration>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<show>public</show>
<!-- excludePackageNames>com.zaxxer.hikari.*</excludePackageNames -->
<attach>true</attach>
<maxmemory>1024m</maxmemory>
</configuration>
<executions>
<execution>
<id>bundle-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>coveralls</id>
<phase>verify</phase>
<goals>
<goal>jacoco</goal>
</goals>
<inherited>false</inherited>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>felix</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>pax.exam.framework</name>
<value>felix</value>
</property>
</activation>
<properties>
<pax.exam.framework>felix</pax.exam.framework>
<pax.exam.logging>none</pax.exam.logging>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>${felix.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

69
pom.xml
View File

@ -56,6 +56,14 @@
<include>*.yml</include> <include>*.yml</include>
</includes> </includes>
</resource> </resource>
<resource>
<targetPath>./messages/</targetPath>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources/messages/</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources> </resources>
<plugins> <plugins>
<plugin> <plugin>
@ -74,12 +82,13 @@
<configuration> <configuration>
<artifactSet> <artifactSet>
<includes> <includes>
<include>com.maxmind.geoip:*</include> <include>org.slf4j:slf4j-api</include>
<include>javax.mail:*</include> <include>org.apache.logging.log4j:log4j-slf4j-impl</include>
<include>com.sun.mail:*</include> <include>com.zaxxer:HikariCP</include>
<include>com.comphenix.attribute:*</include> <include>com.maxmind.geoip:geoip-api</include>
<include>org.mcstats.*:*</include> <include>com.sun.mail:javax.mail</include>
<include>com.zaxxer:*</include> <include>com.comphenix.attribute:AttributeStorage</include>
<include>org.mcstats.bukkit:metrics</include>
</includes> </includes>
</artifactSet> </artifactSet>
<relocations> <relocations>
@ -163,10 +172,10 @@
<url>http://repo.mcstats.org/content/repositories/snapshots/</url> <url>http://repo.mcstats.org/content/repositories/snapshots/</url>
</repository> </repository>
<!-- Local repo for HikariCP-Log4j --> <!-- sgdc3 HikariCP Log4J Repo -->
<repository> <repository>
<id>local-repo</id> <id>hikaricp-log4j-releases</id>
<url>file://${basedir}/localrepo</url> <url>http://nexus-sgdc3.rhcloud.com/nexus/content/repositories/hikaricp-log4j-releases/</url>
</repository> </repository>
</repositories> </repositories>
@ -175,37 +184,11 @@
<!-- Maven Dependencies --> <!-- Maven Dependencies -->
<!-- MySql Connection Pool --> <!-- Database Connection Pool -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.0.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency> -->
<dependency> <dependency>
<groupId>com.zaxxer</groupId> <groupId>com.zaxxer</groupId>
<artifactId>HikariCP-Log4j</artifactId> <artifactId>HikariCP-Log4J</artifactId>
<version>2.4.2-SNAPSHOT</version> <version>2.4.1</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -219,7 +202,7 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- SQLite Library --> <!-- SQLite Connector -->
<dependency> <dependency>
<groupId>org.xerial</groupId> <groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId> <artifactId>sqlite-jdbc</artifactId>
@ -227,7 +210,13 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- Java Email API --> <!-- Java Email API and Implementation -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.4</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>com.sun.mail</groupId> <groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId> <artifactId>javax.mail</artifactId>

View File

@ -134,11 +134,14 @@ public class DataManager {
playerFile.delete(); playerFile.delete();
i++; i++;
} else { } else {
try {
playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml"); playerFile = new File(plugin.ess.getDataFolder() + File.separator + "userdata" + File.separator + Bukkit.getOfflinePlayer(name).getUniqueId() + ".yml");
if (playerFile.exists()) { if (playerFile.exists()) {
playerFile.delete(); playerFile.delete();
i++; i++;
} }
} catch (Exception e) { // Don't do nothing if the method getUniqueId() isn't avariable ( MC version < 1.7.5 )
}
} }
} catch (Exception e) { } catch (Exception e) {
} }

View File

@ -1,12 +1,9 @@
package fr.xephi.authme.settings; package fr.xephi.authme.settings;
import java.io.File; import java.io.File;
import java.io.InputStream;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.ConsoleLogger;
public class Messages extends CustomConfiguration { public class Messages extends CustomConfiguration {
@ -29,13 +26,11 @@ public class Messages extends CustomConfiguration {
* @param filename * @param filename
* The filename to open * The filename to open
*/ */
@SuppressWarnings("deprecation")
public final void loadDefaults(File file) { public final void loadDefaults(File file) {
InputStream stream = AuthMe.getInstance().getResource(file.getName()); if(file.isFile()){
if (stream == null) setDefaults(YamlConfiguration.loadConfiguration(file));
}
return; return;
setDefaults(YamlConfiguration.loadConfiguration(stream));
} }
/** /**

View File

@ -28,7 +28,7 @@ public final class Settings extends YamlConfiguration {
public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe"; public static String PLUGIN_FOLDER = "." + File.separator + "plugins" + File.separator + "AuthMe";
public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache"; public static final String CACHE_FOLDER = Settings.PLUGIN_FOLDER + File.separator + "cache";
public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db"; public static final String AUTH_FILE = Settings.PLUGIN_FOLDER + File.separator + "auths.db";
public static final String MESSAGE_FILE = Settings.PLUGIN_FOLDER + File.separator + "messages"; public static final String MESSAGE_FILE = Settings.PLUGIN_FOLDER + File.separator + "messages" + File.separator + "messages";
public static final String SETTINGS_FILE = Settings.PLUGIN_FOLDER + File.separator + "config.yml"; public static final String SETTINGS_FILE = Settings.PLUGIN_FOLDER + File.separator + "config.yml";
public static List<String> allowCommands = null; public static List<String> allowCommands = null;
public static List<String> getJoinPermissions = null; public static List<String> getJoinPermissions = null;