1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-05 23:22:47 +00:00

Implements packed data directory for faster loading times

This commit is contained in:
2011-12-27 17:28:48 -02:00
parent 92c72ff155
commit 92962241c3
13 changed files with 183 additions and 73 deletions

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="configuration configuration.xsd"
xsi:noNamespaceSchemaLocation="configuration">
<!-- TODO -->
<general>
<!-- TODO -->
<rates>
<!-- TODO -->
<experience>1.0</experience>
<!-- TODO -->
<sp>1.0</sp>
</rates>
</general>
<!-- Services configuration section -->
<services>
<!-- Parameters in this section are used by DatabaseService. If you are
not sure on the usage of any parameter, read the "Configuration" section
in wiki article about DatabaseService. -->
<database>
<!-- Whether or not the service should try to update and create missing
tables at startup. This should be disabled after the first server start as
it could cause data corruption. -->
<automaticSchemaUpdate>true</automaticSchemaUpdate>
<!-- Configures OrientDB engine - plug-and-play -->
<orientdb>
<!-- The OrientDB storage location -->
<url>local:data/database</url>
<!-- The OrientDB username (local storage must use "admin") -->
<username>admin</username>
<!-- The OrientDB password (local storage must use "admin") -->
<password>admin</password>
</orientdb>
<!-- Configures JDBC engine - requires database server configuration -->
<jdbc>
<!-- Defines the connection URL used by JDBC to connect to the database. -->
<url>jdbc:mysql://localhost/l2jserver2</url>
<!-- The engine used to connect to the database. -->
<engine>com.l2jserver.service.database.sql.MySQLDatabaseEngine
</engine>
<!-- The username used to login into the database. NOTE: Try not use
"root" in production servers for security reasons. -->
<username>l2j</username>
<!-- The password used to login into the database. -->
<password>changeme</password>
</jdbc>
<connections>
<!-- The maximum number of active connections -->
<active-maximum>20</active-maximum>
<!-- The maximum number of idle connections -->
<idle-maximum>20</idle-maximum>
<!-- The minimum number of idle connections -->
<idle-minimum>5</idle-minimum>
</connections>
</database>
<!-- Parameters in this section are used by NetworkService. If you are
not sure on the usage of any parameter, read the "Configuration" section
in wiki article about NetworkService. -->
<network>
<!-- The address and port in which the server will listen to -->
<listen>0.0.0.0:7777</listen>
</network>
<!-- Parameters in this section are used by VFSService. If you are not
sure on the usage of any parameter, read the "Configuration" section in wiki
article about VFSService. -->
<vfs>
<!-- The root of the filesystem -->
<root></root>
<!-- The data folder. Relative to the root. Can be a ZIP file. -->
<data>data/</data>
</vfs>
<!-- Parameters in this section are used by VFSService. If you are not
sure on the usage of any parameter, read the "Configuration" section in wiki
article about VFSService. -->
<template>
<!-- The directory in which templates are stored. Relative to "vfs.data" -->
<directory>template/</directory>
</template>
</services>
<!-- /Services configuration section -->
</configuration>

View File

@@ -77,15 +77,15 @@
<root></root>
<!-- The data folder. Relative to the root. Can be a ZIP file. -->
<data>./data</data>
<data>data/</data>
</vfs>
<!-- Parameters in this section are used by VFSService. If you are not
sure on the usage of any parameter, read the "Configuration" section in wiki
article about VFSService. -->
<template>
<!-- The directory in which templates are stored -->
<directory>data/template</directory>
<!-- The directory in which templates are stored. Relative to "vfs.data" -->
<directory>template/</directory>
</template>
</services>
<!-- /Services configuration section -->

View File

@@ -73,15 +73,19 @@
sure on the usage of any parameter, read the "Configuration" section in wiki
article about VFSService. -->
<vfs>
<!-- The root of the filesystem -->
<root></root>
<!-- The data folder. Relative to the root. Can be a ZIP file. -->
<data>data.zip</data>
</vfs>
<!-- Parameters in this section are used by VFSService. If you are not
sure on the usage of any parameter, read the "Configuration" section in wiki
article about VFSService. -->
<template>
<!-- The directory in which templates are stored -->
<directory>data/template</directory>
<!-- The directory in which templates are stored. Relative to "vfs.data" -->
<directory>template/</directory>
</template>
</services>
<!-- /Services configuration section -->

View File

@@ -20,6 +20,7 @@
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/distribution-data.xml</descriptor>
<descriptor>src/main/assembly/distribution-mysql5-bin.xml</descriptor>
<descriptor>src/main/assembly/distribution-orientdb-bin.xml</descriptor>
<descriptor>src/main/assembly/distribution-h2-bin.xml</descriptor>
@@ -28,6 +29,30 @@
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<files>${project.artifactId}</files>
<classifiers>mysql5-bin</classifiers>
<types>zip</types>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libs/</classpathPrefix>
<mainClass>com.l2jserver.L2JGameServerMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

View File

@@ -8,19 +8,6 @@
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>data/**</include>
</includes>
<excludes>
<exclude>.gitignore</exclude>
<exclude>data/cache/**</exclude>
<exclude>data/pathing.db</exclude>
<exclude>data/database/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/global</directory>
<outputDirectory>/</outputDirectory>
@@ -33,6 +20,11 @@
<destName>l2jserver2.jar</destName>
<fileMode>0755</fileMode>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-data.zip</source>
<outputDirectory>/</outputDirectory>
<destName>data.zip</destName>
</file>
</files>
<dependencySets>
<dependencySet>

View File

@@ -8,19 +8,6 @@
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>data/**</include>
</includes>
<excludes>
<exclude>.gitignore</exclude>
<exclude>data/cache/**</exclude>
<exclude>data/pathing.db</exclude>
<exclude>data/database/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/global</directory>
<outputDirectory>/</outputDirectory>
@@ -33,6 +20,11 @@
<destName>l2jserver2.jar</destName>
<fileMode>0755</fileMode>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-data.zip</source>
<outputDirectory>/</outputDirectory>
<destName>data.zip</destName>
</file>
</files>
<dependencySets>
<dependencySet>

View File

@@ -8,19 +8,6 @@
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>data/**</include>
</includes>
<excludes>
<exclude>.gitignore</exclude>
<exclude>data/cache/**</exclude>
<exclude>data/pathing.db</exclude>
<exclude>data/database/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/global</directory>
<outputDirectory>/</outputDirectory>
@@ -33,6 +20,11 @@
<destName>l2jserver2.jar</destName>
<fileMode>0755</fileMode>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-data.zip</source>
<outputDirectory>/</outputDirectory>
<destName>data.zip</destName>
</file>
</files>
<dependencySets>
<dependencySet>

View File

@@ -8,19 +8,6 @@
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>data/**</include>
</includes>
<excludes>
<exclude>.gitignore</exclude>
<exclude>data/cache/**</exclude>
<exclude>data/pathing.db</exclude>
<exclude>data/database/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/global</directory>
<outputDirectory>/</outputDirectory>
@@ -33,6 +20,11 @@
<destName>l2jserver2.jar</destName>
<fileMode>0755</fileMode>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-data.zip</source>
<outputDirectory>/</outputDirectory>
<destName>data.zip</destName>
</file>
</files>
<dependencySets>
<dependencySet>

View File

@@ -0,0 +1,22 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>data</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/data</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>.gitignore</exclude>
<exclude>cache/**</exclude>
<exclude>pathing.db</exclude>
<exclude>database/**</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View File

@@ -120,7 +120,7 @@ public class GameServerJDBCDatabaseService extends AbstractSQLDatabaseService
updateSchema(QLogChat.logChat);
if (updateSchema(QNPC.npc)) {
try {
importData(vfsService.resolve("data/static/npc.csv"), QNPC.npc);
importData(vfsService.resolveDataFile("static/npc.csv"), QNPC.npc);
} catch (IOException e) {
throw new DatabaseException(e);
}

View File

@@ -100,7 +100,7 @@ public class GameServerOrientDatabaseService extends
updateSchema(QLogChat.logChat);
if (updateSchema(QNPC.npc)) {
try {
importData(vfsService.resolve("data/static/npc.csv"), QNPC.npc);
importData(vfsService.resolveDataFile("static/npc.csv"), QNPC.npc);
} catch (IOException e) {
throw new DatabaseException(e);
}

View File

@@ -18,7 +18,6 @@ package com.l2jserver.service.game.template;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -143,9 +142,9 @@ public class XMLTemplateService extends AbstractService implements
/**
* @return the directory in which templates are stored
*/
@ConfigurationPropertyGetter(defaultValue = "data/template")
@ConfigurationPropertyGetter(defaultValue = "template/")
@ConfigurationXPath("/configuration/services/template/directory")
URI getTemplateDirectory();
String getTemplateDirectory();
/**
* @param file
@@ -153,7 +152,7 @@ public class XMLTemplateService extends AbstractService implements
*/
@ConfigurationPropertySetter
@ConfigurationXPath("/configuration/services/template/directory")
void setTemplateDirectory(URI file);
void setTemplateDirectory(String file);
}
/**
@@ -215,8 +214,8 @@ public class XMLTemplateService extends AbstractService implements
unmarshaller.setAdapter(effectIdTemplateAdapter);
unmarshaller.setAdapter(teleportationIdTemplateAdapter);
final Path templatePath = vfsService.resolve(config
.getTemplateDirectory().toString());
final Path templatePath = vfsService.resolveDataFile(config
.getTemplateDirectory());
log.info("Scanning {} for XML templates", templatePath);