mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-05 23:22:47 +00:00
Implements XML based service descriptor allowing to switch services
This commit is contained in:
1
l2jserver2-gameserver/.gitignore
vendored
1
l2jserver2-gameserver/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
/log
|
||||
/derby.log
|
||||
/services.xml
|
||||
|
||||
1
l2jserver2-gameserver/config/.gitignore
vendored
1
l2jserver2-gameserver/config/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/config.xml
|
||||
@@ -1,92 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,92 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,92 +0,0 @@
|
||||
<?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.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. Relative to "vfs.data" -->
|
||||
<directory>template/</directory>
|
||||
</template>
|
||||
</services>
|
||||
<!-- /Services configuration section -->
|
||||
</configuration>
|
||||
114
l2jserver2-gameserver/distribution/services.xml
Normal file
114
l2jserver2-gameserver/distribution/services.xml
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<!-- DAO Module configuration -->
|
||||
<dao module="com.l2jserver.service.database.JDBCDAOModule" />
|
||||
|
||||
<!-- OrientDB database service -->
|
||||
<service interface="com.l2jserver.service.database.DatabaseService"
|
||||
implementation="com.l2jserver.service.database.GameServerOrientDatabaseService">
|
||||
<!-- Whether the database schema should be updated at startup -->
|
||||
<!-- Slows down a bit at start time, but guarantees consistency -->
|
||||
<!-- Recommended to only be enabled after an server update -->
|
||||
<schema automaticUpdate="true" />
|
||||
<!-- The connection URL defines where the database data is stored -->
|
||||
<connection url="local:data/database">
|
||||
<!-- Database authentication. Should not be touched unless you know what
|
||||
you are doing! -->
|
||||
<authentication username="admin" password="admin" />
|
||||
</connection>
|
||||
</service>
|
||||
|
||||
<!-- Virtual file system service -->
|
||||
<service interface="com.l2jserver.service.core.vfs.VFSService"
|
||||
implementation="com.l2jserver.service.core.vfs.TrueZipVFSService">
|
||||
<!-- Configures the root of the server data. Where all the files are placed. -->
|
||||
<fileSystem root="./">
|
||||
<!-- The "data file system" location. There, templates, static data and
|
||||
several other important files are located. This can be a zip or a directory. -->
|
||||
<!-- The "data file system" is relative to the file system root. -->
|
||||
<data root="data.zip" />
|
||||
</fileSystem>
|
||||
</service>
|
||||
|
||||
<!-- Template service configuration -->
|
||||
<service interface="com.l2jserver.service.game.template.TemplateService"
|
||||
implementation="com.l2jserver.service.game.template.XMLTemplateService">
|
||||
<!-- The root where template data is located. Relative to the "data file
|
||||
system" -->
|
||||
<templates root="template/" />
|
||||
</service>
|
||||
|
||||
<!-- Network service -->
|
||||
<service interface="com.l2jserver.service.network.NetworkService"
|
||||
implementation="com.l2jserver.service.network.NettyNetworkService">
|
||||
<!-- The port in which the server should listen for incoming connections -->
|
||||
<!-- NOTE: this port must be open manually on any firewall or router that
|
||||
is between you and other players. If you wish to play on the same machine
|
||||
you normally don't need to change anything here nor in the firewall. -->
|
||||
<server listen="0.0.0.0:7777" />
|
||||
</service>
|
||||
|
||||
<!-- ###################################################################### -->
|
||||
<!-- ########################### CORE SERVICES ############################ -->
|
||||
<!-- ###################################################################### -->
|
||||
<!-- Those services provide basic core features and are required for server
|
||||
startup process -->
|
||||
<service interface="com.l2jserver.service.core.LoggingService"
|
||||
implementation="com.l2jserver.service.core.Log4JLoggingService" />
|
||||
<service interface="com.l2jserver.service.core.threading.ThreadService"
|
||||
implementation="com.l2jserver.service.core.threading.ThreadServiceImpl" />
|
||||
<service interface="com.l2jserver.service.configuration.ConfigurationService"
|
||||
implementation="com.l2jserver.service.configuration.XMLConfigurationService" />
|
||||
<service interface="com.l2jserver.service.cache.CacheService"
|
||||
implementation="com.l2jserver.service.cache.SoftCacheService" />
|
||||
|
||||
|
||||
<!-- ###################################################################### -->
|
||||
<!-- ########################### GAME SERVICES ############################ -->
|
||||
<!-- ###################################################################### -->
|
||||
<!-- Those services provide all the in-game features and most of them are
|
||||
required for players to be able to login in the server -->
|
||||
<service interface="com.l2jserver.service.game.world.WorldIDService"
|
||||
implementation="com.l2jserver.service.game.world.CachedWorldIDService" />
|
||||
<service interface="com.l2jserver.service.game.map.pathing.PathingService"
|
||||
implementation="com.l2jserver.service.game.map.pathing.MapperPathingService" />
|
||||
<service interface="com.l2jserver.service.game.scripting.ScriptingService"
|
||||
implementation="com.l2jserver.service.game.scripting.ScriptingServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.chat.ChatService"
|
||||
implementation="com.l2jserver.service.game.chat.SimpleChatService" />
|
||||
<service interface="com.l2jserver.service.game.chat.ChatLoggingService"
|
||||
implementation="com.l2jserver.service.game.chat.DatabaseChatLoggingService" />
|
||||
<service interface="com.l2jserver.service.game.admin.AdministratorService"
|
||||
implementation="com.l2jserver.service.game.admin.AdministratorServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.spawn.SpawnService"
|
||||
implementation="com.l2jserver.service.game.spawn.SpawnServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.character.CharacterService"
|
||||
implementation="com.l2jserver.service.game.character.CharacterServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.character.ShortcutService"
|
||||
implementation="com.l2jserver.service.game.character.ShortcutServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.AttackService"
|
||||
implementation="com.l2jserver.service.game.AttackServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.npc.NPCService"
|
||||
implementation="com.l2jserver.service.game.npc.NPCServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.item.ItemService"
|
||||
implementation="com.l2jserver.service.game.item.ItemServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.world.WorldService"
|
||||
implementation="com.l2jserver.service.game.world.WorldServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.world.event.WorldEventDispatcher"
|
||||
implementation="com.l2jserver.service.game.world.event.WorldEventDispatcherImpl" />
|
||||
|
||||
|
||||
<!-- ####################################################################### -->
|
||||
<!-- ########################## NETWORK SERVICES ########################### -->
|
||||
<!-- ####################################################################### -->
|
||||
<!-- Those services all network related services that will communicate the
|
||||
server software to the player computer running the game client. Although
|
||||
not required, without them, becomes impossible to connect to the server in
|
||||
order to play the game. -->
|
||||
<service interface="com.l2jserver.service.network.keygen.BlowfishKeygenService"
|
||||
implementation="com.l2jserver.service.network.keygen.SecureBlowfishKeygenService" />
|
||||
<service interface="com.l2jserver.service.network.gameguard.GameGuardService"
|
||||
implementation="com.l2jserver.service.network.gameguard.GameGuardServiceImpl" />
|
||||
<service interface="com.l2jserver.service.network.broadcast.BroadcastService"
|
||||
implementation="com.l2jserver.service.network.broadcast.BroadcastServiceImpl" />
|
||||
</services>
|
||||
125
l2jserver2-gameserver/services-sample.xml
Normal file
125
l2jserver2-gameserver/services-sample.xml
Normal file
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!-- This file should be renamed as "services.xml" and configured according
|
||||
to your needs. Since "services.xml" has been added to ".gitignore", this
|
||||
means that your password won't be sent to the repository when you make a
|
||||
commit. -->
|
||||
<!-- IMPORTANT NOTE: Do not forget to edit "distribution/services.xml" with
|
||||
new services definitions. Only that file is included in the server's binary
|
||||
distributions -->
|
||||
<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<!-- DAO Module configuration -->
|
||||
<dao module="com.l2jserver.service.database.JDBCDAOModule" />
|
||||
|
||||
<!-- JDBC database service -->
|
||||
<service interface="com.l2jserver.service.database.DatabaseService"
|
||||
implementation="com.l2jserver.service.database.GameServerJDBCDatabaseService">
|
||||
<!-- Whether the database schema should be updated at startup -->
|
||||
<!-- Slows down a bit at start time, but guarantees consistency -->
|
||||
<!-- Enabled for development servers -->
|
||||
<schema automaticUpdate="true" />
|
||||
<!-- Defines the JDBC connection URL -->
|
||||
<connection url="jdbc:mysql://localhost/l2jserver2">
|
||||
<!-- The database authentication (username and password) -->
|
||||
<authentication username="l2jserver2" password="changeme" />
|
||||
<!-- Specifies the database engine to use - will load JDBC driver and
|
||||
SQL templates -->
|
||||
<engine class="com.l2jserver.service.database.sql.MySQLDatabaseEngine" />
|
||||
<!-- Defines the database connection pool limits -->
|
||||
<pool max-active="20" max-idle="20" min-idle="5" />
|
||||
</connection>
|
||||
</service>
|
||||
|
||||
<!-- Virtual file system service -->
|
||||
<service interface="com.l2jserver.service.core.vfs.VFSService"
|
||||
implementation="com.l2jserver.service.core.vfs.TrueZipVFSService">
|
||||
<!-- Configures the root of the server data. Where all the files are placed. -->
|
||||
<fileSystem root="./">
|
||||
<!-- The "data file system" location. There, templates, static data and
|
||||
several other important files are located. This can be a zip or a directory. -->
|
||||
<!-- The "data file system" is relative to the file system root. -->
|
||||
<data root="data/" />
|
||||
</fileSystem>
|
||||
</service>
|
||||
|
||||
<!-- Template service configuration -->
|
||||
<service interface="com.l2jserver.service.game.template.TemplateService"
|
||||
implementation="com.l2jserver.service.game.template.XMLTemplateService">
|
||||
<!-- The root where template data is located. Relative to the "data file
|
||||
system" -->
|
||||
<templates root="template/" />
|
||||
</service>
|
||||
|
||||
<!-- Network service -->
|
||||
<service interface="com.l2jserver.service.network.NetworkService"
|
||||
implementation="com.l2jserver.service.network.NettyNetworkService">
|
||||
<!-- The port in which the server should listen for incoming connections -->
|
||||
<!-- NOTE: this port must be open manually on any firewall or router that
|
||||
is between you and other players. If you wish to play on the same machine
|
||||
you normally don't need to change anything here nor in the firewall. -->
|
||||
<server listen="0.0.0.0:7777" />
|
||||
</service>
|
||||
|
||||
<!-- ###################################################################### -->
|
||||
<!-- ########################### CORE SERVICES ############################ -->
|
||||
<!-- ###################################################################### -->
|
||||
<!-- Those services provide basic core features and are required for server
|
||||
startup process -->
|
||||
<service interface="com.l2jserver.service.core.LoggingService"
|
||||
implementation="com.l2jserver.service.core.Log4JLoggingService" />
|
||||
<service interface="com.l2jserver.service.core.threading.ThreadService"
|
||||
implementation="com.l2jserver.service.core.threading.ThreadServiceImpl" />
|
||||
<service interface="com.l2jserver.service.configuration.ConfigurationService"
|
||||
implementation="com.l2jserver.service.configuration.XMLConfigurationService" />
|
||||
<service interface="com.l2jserver.service.cache.CacheService"
|
||||
implementation="com.l2jserver.service.cache.SoftCacheService" />
|
||||
|
||||
|
||||
<!-- ###################################################################### -->
|
||||
<!-- ########################### GAME SERVICES ############################ -->
|
||||
<!-- ###################################################################### -->
|
||||
<!-- Those services provide all the in-game features and most of them are
|
||||
required for players to be able to login in the server -->
|
||||
<service interface="com.l2jserver.service.game.world.WorldIDService"
|
||||
implementation="com.l2jserver.service.game.world.CachedWorldIDService" />
|
||||
<service interface="com.l2jserver.service.game.map.pathing.PathingService"
|
||||
implementation="com.l2jserver.service.game.map.pathing.MapperPathingService" />
|
||||
<service interface="com.l2jserver.service.game.scripting.ScriptingService"
|
||||
implementation="com.l2jserver.service.game.scripting.ScriptingServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.chat.ChatService"
|
||||
implementation="com.l2jserver.service.game.chat.SimpleChatService" />
|
||||
<service interface="com.l2jserver.service.game.chat.ChatLoggingService"
|
||||
implementation="com.l2jserver.service.game.chat.DatabaseChatLoggingService" />
|
||||
<service interface="com.l2jserver.service.game.admin.AdministratorService"
|
||||
implementation="com.l2jserver.service.game.admin.AdministratorServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.spawn.SpawnService"
|
||||
implementation="com.l2jserver.service.game.spawn.SpawnServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.character.CharacterService"
|
||||
implementation="com.l2jserver.service.game.character.CharacterServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.character.ShortcutService"
|
||||
implementation="com.l2jserver.service.game.character.ShortcutServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.AttackService"
|
||||
implementation="com.l2jserver.service.game.AttackServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.npc.NPCService"
|
||||
implementation="com.l2jserver.service.game.npc.NPCServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.item.ItemService"
|
||||
implementation="com.l2jserver.service.game.item.ItemServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.world.WorldService"
|
||||
implementation="com.l2jserver.service.game.world.WorldServiceImpl" />
|
||||
<service interface="com.l2jserver.service.game.world.event.WorldEventDispatcher"
|
||||
implementation="com.l2jserver.service.game.world.event.WorldEventDispatcherImpl" />
|
||||
|
||||
|
||||
<!-- ####################################################################### -->
|
||||
<!-- ########################## NETWORK SERVICES ########################### -->
|
||||
<!-- ####################################################################### -->
|
||||
<!-- Those services all network related services that will communicate the
|
||||
server software to the player computer running the game client. Although
|
||||
not required, without them, becomes impossible to connect to the server in
|
||||
order to play the game. -->
|
||||
<service interface="com.l2jserver.service.network.keygen.BlowfishKeygenService"
|
||||
implementation="com.l2jserver.service.network.keygen.SecureBlowfishKeygenService" />
|
||||
<service interface="com.l2jserver.service.network.gameguard.GameGuardService"
|
||||
implementation="com.l2jserver.service.network.gameguard.GameGuardServiceImpl" />
|
||||
<service interface="com.l2jserver.service.network.broadcast.BroadcastService"
|
||||
implementation="com.l2jserver.service.network.broadcast.BroadcastServiceImpl" />
|
||||
</services>
|
||||
@@ -9,7 +9,7 @@
|
||||
<baseDirectory></baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/distribution/global</directory>
|
||||
<directory>${project.basedir}/distribution</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<baseDirectory></baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/distribution/global</directory>
|
||||
<directory>${project.basedir}/distribution</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<baseDirectory></baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/distribution/global</directory>
|
||||
<directory>${project.basedir}/distribution</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<baseDirectory></baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${project.basedir}/distribution/global</directory>
|
||||
<directory>${project.basedir}/distribution</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import com.l2jserver.model.id.provider.IDProviderModule;
|
||||
import com.l2jserver.service.ServiceModule;
|
||||
import com.l2jserver.service.database.OrientDBDAOModule;
|
||||
|
||||
/**
|
||||
* The game server Google Guice {@link Module}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class GameServerModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
install(new ServiceModule());
|
||||
install(new IDProviderModule());
|
||||
install(new OrientDBDAOModule());
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,20 @@
|
||||
*/
|
||||
package com.l2jserver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.l2jserver.model.id.provider.IDProviderModule;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.service.ServiceException;
|
||||
import com.l2jserver.service.ServiceManager;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
import com.l2jserver.service.cache.CacheService;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
@@ -65,17 +77,38 @@ public class L2JGameServerMain {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void main(String[] args) {
|
||||
final L2JGameServer server = new L2JGameServer();
|
||||
final ServiceManager serviceManager = new ServiceManager();
|
||||
try {
|
||||
final ServiceManager serviceManager = server.getInjector()
|
||||
.getInstance(ServiceManager.class);
|
||||
serviceManager.load(Paths.get("services.xml"));
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("Service class not found: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} catch (SAXException | DOMException | IOException
|
||||
| ParserConfigurationException e) {
|
||||
System.out.println("Error parsing XML service descriptor");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} catch (ServiceException e) {
|
||||
System.out.println("Error loading XML service descriptor");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
serviceManager.init(Guice.createInjector(new IDProviderModule(),
|
||||
serviceManager.newGuiceModule()));
|
||||
} catch (ServiceStartException e) {
|
||||
System.out.println("Error stating basic services");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
for (final Class<?>[] category : SERVICES) {
|
||||
for (final Class<?> service : category) {
|
||||
serviceManager.start((Class<? extends Service>) service);
|
||||
}
|
||||
}
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.service;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Scopes;
|
||||
import com.l2jserver.service.cache.CacheService;
|
||||
import com.l2jserver.service.cache.SoftCacheService;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
import com.l2jserver.service.configuration.XMLConfigurationService;
|
||||
import com.l2jserver.service.core.Log4JLoggingService;
|
||||
import com.l2jserver.service.core.LoggingService;
|
||||
import com.l2jserver.service.core.threading.ThreadService;
|
||||
import com.l2jserver.service.core.threading.ThreadServiceImpl;
|
||||
import com.l2jserver.service.core.vfs.TrueZipVFSService;
|
||||
import com.l2jserver.service.core.vfs.VFSService;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.database.GameServerOrientDatabaseService;
|
||||
import com.l2jserver.service.game.AttackService;
|
||||
import com.l2jserver.service.game.AttackServiceImpl;
|
||||
import com.l2jserver.service.game.admin.AdministratorService;
|
||||
import com.l2jserver.service.game.admin.AdministratorServiceImpl;
|
||||
import com.l2jserver.service.game.character.CharacterService;
|
||||
import com.l2jserver.service.game.character.CharacterServiceImpl;
|
||||
import com.l2jserver.service.game.character.ShortcutService;
|
||||
import com.l2jserver.service.game.character.ShortcutServiceImpl;
|
||||
import com.l2jserver.service.game.chat.ChatLoggingService;
|
||||
import com.l2jserver.service.game.chat.ChatService;
|
||||
import com.l2jserver.service.game.chat.DatabaseChatLoggingService;
|
||||
import com.l2jserver.service.game.chat.SimpleChatService;
|
||||
import com.l2jserver.service.game.item.ItemService;
|
||||
import com.l2jserver.service.game.item.ItemServiceImpl;
|
||||
import com.l2jserver.service.game.map.pathing.MapperPathingService;
|
||||
import com.l2jserver.service.game.map.pathing.PathingService;
|
||||
import com.l2jserver.service.game.npc.NPCService;
|
||||
import com.l2jserver.service.game.npc.NPCServiceImpl;
|
||||
import com.l2jserver.service.game.scripting.ScriptingService;
|
||||
import com.l2jserver.service.game.scripting.ScriptingServiceImpl;
|
||||
import com.l2jserver.service.game.spawn.SpawnService;
|
||||
import com.l2jserver.service.game.spawn.SpawnServiceImpl;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
import com.l2jserver.service.game.template.XMLTemplateService;
|
||||
import com.l2jserver.service.game.world.CachedWorldIDService;
|
||||
import com.l2jserver.service.game.world.WorldIDService;
|
||||
import com.l2jserver.service.game.world.WorldService;
|
||||
import com.l2jserver.service.game.world.WorldServiceImpl;
|
||||
import com.l2jserver.service.game.world.event.WorldEventDispatcher;
|
||||
import com.l2jserver.service.game.world.event.WorldEventDispatcherImpl;
|
||||
import com.l2jserver.service.network.NettyNetworkService;
|
||||
import com.l2jserver.service.network.NetworkService;
|
||||
import com.l2jserver.service.network.broadcast.BroadcastService;
|
||||
import com.l2jserver.service.network.broadcast.BroadcastServiceImpl;
|
||||
import com.l2jserver.service.network.gameguard.GameGuardService;
|
||||
import com.l2jserver.service.network.gameguard.GameGuardServiceImpl;
|
||||
import com.l2jserver.service.network.keygen.BlowfishKeygenService;
|
||||
import com.l2jserver.service.network.keygen.SecureBlowfishKeygenService;
|
||||
|
||||
/**
|
||||
* Google Guice {@link Module} for services
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ServiceModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ServiceManager.class).in(Scopes.SINGLETON);
|
||||
bind(LoggingService.class).to(Log4JLoggingService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(VFSService.class).to(TrueZipVFSService.class).in(Scopes.SINGLETON);
|
||||
bind(ThreadService.class).to(ThreadServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(ConfigurationService.class).to(XMLConfigurationService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(CacheService.class).to(SoftCacheService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
|
||||
bind(DatabaseService.class).to(GameServerOrientDatabaseService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(WorldIDService.class).to(CachedWorldIDService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
bind(PathingService.class).to(MapperPathingService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
bind(BlowfishKeygenService.class).to(SecureBlowfishKeygenService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(NetworkService.class).to(NettyNetworkService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(GameGuardService.class).to(GameGuardServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(ScriptingService.class).to(ScriptingServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(TemplateService.class).to(XMLTemplateService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
bind(ChatService.class).to(SimpleChatService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(ChatLoggingService.class).to(DatabaseChatLoggingService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(AdministratorService.class).to(AdministratorServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(SpawnService.class).to(SpawnServiceImpl.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(BroadcastService.class).to(BroadcastServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
bind(CharacterService.class).to(CharacterServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(ShortcutService.class).to(ShortcutServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
bind(AttackService.class).to(AttackServiceImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(NPCService.class).to(NPCServiceImpl.class).in(Scopes.SINGLETON);
|
||||
bind(ItemService.class).to(ItemServiceImpl.class).in(Scopes.SINGLETON);
|
||||
|
||||
bind(WorldService.class).to(WorldServiceImpl.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(WorldEventDispatcher.class).to(WorldEventDispatcherImpl.class).in(
|
||||
Scopes.SINGLETON);
|
||||
}
|
||||
}
|
||||
@@ -76,8 +76,6 @@ import com.mysema.query.sql.types.EnumByNameType;
|
||||
public class GameServerJDBCDatabaseService extends AbstractSQLDatabaseService
|
||||
implements DatabaseService {
|
||||
/**
|
||||
* @param configService
|
||||
* the config service
|
||||
* @param cacheService
|
||||
* the cache service
|
||||
* @param threadService
|
||||
@@ -88,11 +86,10 @@ public class GameServerJDBCDatabaseService extends AbstractSQLDatabaseService
|
||||
* the {@link DataAccessObject DAO} resolver
|
||||
*/
|
||||
@Inject
|
||||
public GameServerJDBCDatabaseService(ConfigurationService configService,
|
||||
CacheService cacheService, ThreadService threadService,
|
||||
VFSService vfsService, DAOResolver daoResolver) {
|
||||
public GameServerJDBCDatabaseService(CacheService cacheService,
|
||||
ThreadService threadService, VFSService vfsService,
|
||||
DAOResolver daoResolver) {
|
||||
super(
|
||||
configService,
|
||||
cacheService,
|
||||
threadService,
|
||||
vfsService,
|
||||
@@ -120,7 +117,8 @@ public class GameServerJDBCDatabaseService extends AbstractSQLDatabaseService
|
||||
updateSchema(QLogChat.logChat);
|
||||
if (updateSchema(QNPC.npc)) {
|
||||
try {
|
||||
importData(vfsService.resolveDataFile("static/npc.csv"), QNPC.npc);
|
||||
importData(vfsService.resolveDataFile("static/npc.csv"),
|
||||
QNPC.npc);
|
||||
} catch (IOException e) {
|
||||
throw new DatabaseException(e);
|
||||
}
|
||||
|
||||
@@ -70,8 +70,6 @@ public class GameServerOrientDatabaseService extends
|
||||
private final VFSService vfsService;
|
||||
|
||||
/**
|
||||
* @param configService
|
||||
* the config service
|
||||
* @param cacheService
|
||||
* the cache service
|
||||
* @param threadService
|
||||
@@ -82,10 +80,10 @@ public class GameServerOrientDatabaseService extends
|
||||
* the {@link DataAccessObject DAO} resolver
|
||||
*/
|
||||
@Inject
|
||||
public GameServerOrientDatabaseService(ConfigurationService configService,
|
||||
CacheService cacheService, ThreadService threadService,
|
||||
final VFSService vfsService, DAOResolver daoResolver) {
|
||||
super(configService, cacheService, threadService, daoResolver);
|
||||
public GameServerOrientDatabaseService(CacheService cacheService,
|
||||
ThreadService threadService, final VFSService vfsService,
|
||||
DAOResolver daoResolver) {
|
||||
super(cacheService, threadService, daoResolver);
|
||||
this.vfsService = vfsService;
|
||||
}
|
||||
|
||||
@@ -100,7 +98,8 @@ public class GameServerOrientDatabaseService extends
|
||||
updateSchema(QLogChat.logChat);
|
||||
if (updateSchema(QNPC.npc)) {
|
||||
try {
|
||||
importData(vfsService.resolveDataFile("static/npc.csv"), QNPC.npc);
|
||||
importData(vfsService.resolveDataFile("static/npc.csv"),
|
||||
QNPC.npc);
|
||||
} catch (IOException e) {
|
||||
throw new DatabaseException(e);
|
||||
}
|
||||
|
||||
@@ -47,14 +47,13 @@ import com.l2jserver.model.template.character.CharacterTemplate;
|
||||
import com.l2jserver.model.template.item.ItemTemplate;
|
||||
import com.l2jserver.model.template.npc.NPCTemplate;
|
||||
import com.l2jserver.model.template.npc.TeleportationTemplate;
|
||||
import com.l2jserver.service.AbstractService;
|
||||
import com.l2jserver.service.AbstractConfigurableService;
|
||||
import com.l2jserver.service.AbstractService.Depends;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
import com.l2jserver.service.cache.Cache;
|
||||
import com.l2jserver.service.cache.CacheService;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
|
||||
import com.l2jserver.service.core.LoggingService;
|
||||
import com.l2jserver.service.core.vfs.VFSService;
|
||||
import com.l2jserver.util.jaxb.CharacterTemplateIDAdapter;
|
||||
@@ -72,7 +71,8 @@ import com.l2jserver.util.jaxb.TeleportationTemplateIDAdapter;
|
||||
*/
|
||||
@Depends({ LoggingService.class, VFSService.class, CacheService.class,
|
||||
ConfigurationService.class })
|
||||
public class XMLTemplateService extends AbstractService implements
|
||||
public class XMLTemplateService extends
|
||||
AbstractConfigurableService<XMLTemplateServiceConfiguration> implements
|
||||
TemplateService {
|
||||
/**
|
||||
* The logger
|
||||
@@ -88,10 +88,6 @@ public class XMLTemplateService extends AbstractService implements
|
||||
*/
|
||||
private final CacheService cacheService;
|
||||
|
||||
/**
|
||||
* The XML template service configuration
|
||||
*/
|
||||
private final XMLTemplateServiceConfiguration config;
|
||||
/**
|
||||
* The npc template id adapter
|
||||
*/
|
||||
@@ -132,36 +128,11 @@ public class XMLTemplateService extends AbstractService implements
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Cache<TemplateID, Template> templates;
|
||||
|
||||
/**
|
||||
* XML {@link TemplateService} configuration interface
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface XMLTemplateServiceConfiguration extends
|
||||
TemplateServiceConfiguration {
|
||||
/**
|
||||
* @return the directory in which templates are stored
|
||||
*/
|
||||
@ConfigurationPropertyGetter(defaultValue = "template/")
|
||||
@ConfigurationXPath("/configuration/services/template/directory")
|
||||
String getTemplateDirectory();
|
||||
|
||||
/**
|
||||
* @param file
|
||||
* the directory in which templates are stored
|
||||
*/
|
||||
@ConfigurationPropertySetter
|
||||
@ConfigurationXPath("/configuration/services/template/directory")
|
||||
void setTemplateDirectory(String file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vfsService
|
||||
* the vfs service
|
||||
* @param cacheService
|
||||
* the cache service
|
||||
* @param configService
|
||||
* the configuration service
|
||||
* the cache servicef
|
||||
* @param npcTemplateIdAdapter
|
||||
* the npc template id adapter
|
||||
* @param itemTemplateIdAdapter
|
||||
@@ -177,16 +148,16 @@ public class XMLTemplateService extends AbstractService implements
|
||||
*/
|
||||
@Inject
|
||||
public XMLTemplateService(final VFSService vfsService,
|
||||
CacheService cacheService, ConfigurationService configService,
|
||||
CacheService cacheService,
|
||||
NPCTemplateIDAdapter npcTemplateIdAdapter,
|
||||
ItemTemplateIDAdapter itemTemplateIdAdapter,
|
||||
SkillTemplateIDAdapter skillTemplateIdAdapter,
|
||||
CharacterTemplateIDAdapter charIdTemplateAdapter,
|
||||
EffectTemplateIDAdapter effectIdTemplateAdapter,
|
||||
TeleportationTemplateIDAdapter teleportationIdTemplateAdapter) {
|
||||
super(XMLTemplateServiceConfiguration.class);
|
||||
this.vfsService = vfsService;
|
||||
this.cacheService = cacheService;
|
||||
this.config = configService.get(XMLTemplateServiceConfiguration.class);
|
||||
this.npcTemplateIdAdapter = npcTemplateIdAdapter;
|
||||
this.itemTemplateIdAdapter = itemTemplateIdAdapter;
|
||||
this.skillTemplateIdAdapter = skillTemplateIdAdapter;
|
||||
|
||||
@@ -1,42 +1,43 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
/**
|
||||
* The L2JGameServer class
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class L2JGameServer {
|
||||
/**
|
||||
* The server injector
|
||||
*/
|
||||
private final Injector injector = Guice
|
||||
.createInjector(new GameServerModule());
|
||||
|
||||
/**
|
||||
* Get the injector
|
||||
*
|
||||
* @return the injector
|
||||
*/
|
||||
public Injector getInjector() {
|
||||
return injector;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.service.game.template;
|
||||
|
||||
import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
|
||||
import com.l2jserver.service.game.template.TemplateService.TemplateServiceConfiguration;
|
||||
|
||||
/**
|
||||
* XML {@link TemplateService} configuration interface
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface XMLTemplateServiceConfiguration extends
|
||||
TemplateServiceConfiguration {
|
||||
/**
|
||||
* @return the directory in which templates are stored
|
||||
*/
|
||||
@ConfigurationPropertyGetter(defaultValue = "template/")
|
||||
@ConfigurationXPath("templates/@root")
|
||||
String getTemplateDirectory();
|
||||
|
||||
/**
|
||||
* @param file
|
||||
* the directory in which templates are stored
|
||||
*/
|
||||
@ConfigurationPropertySetter
|
||||
@ConfigurationXPath("templates/@root")
|
||||
void setTemplateDirectory(String file);
|
||||
}
|
||||
@@ -39,9 +39,8 @@ import com.l2jserver.game.net.Lineage2Client;
|
||||
import com.l2jserver.game.net.Lineage2PipelineFactory;
|
||||
import com.l2jserver.game.net.packet.ServerPacket;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.service.AbstractService;
|
||||
import com.l2jserver.service.AbstractConfigurableService;
|
||||
import com.l2jserver.service.AbstractService.Depends;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
import com.l2jserver.service.core.LoggingService;
|
||||
import com.l2jserver.service.core.threading.ThreadPool;
|
||||
import com.l2jserver.service.core.threading.ThreadPoolPriority;
|
||||
@@ -58,7 +57,8 @@ import com.l2jserver.util.factory.CollectionFactory;
|
||||
*/
|
||||
@Depends({ LoggingService.class, ThreadService.class,
|
||||
BlowfishKeygenService.class, WorldService.class })
|
||||
public class NettyNetworkService extends AbstractService implements
|
||||
public class NettyNetworkService extends
|
||||
AbstractConfigurableService<NetworkServiceConfiguration> implements
|
||||
NetworkService {
|
||||
/**
|
||||
* The logger
|
||||
@@ -70,10 +70,6 @@ public class NettyNetworkService extends AbstractService implements
|
||||
*/
|
||||
private final ThreadService threadService;
|
||||
|
||||
/**
|
||||
* The network configuration object
|
||||
*/
|
||||
private final NetworkConfiguration config;
|
||||
/**
|
||||
* The Google Guice {@link Injector}
|
||||
*/
|
||||
@@ -101,18 +97,15 @@ public class NettyNetworkService extends AbstractService implements
|
||||
private Set<Lineage2Client> clients = CollectionFactory.newSet();
|
||||
|
||||
/**
|
||||
* @param configService
|
||||
* the configuration service
|
||||
* @param injector
|
||||
* the {@link Guice} {@link Injector}
|
||||
* @param threadService
|
||||
* the {@link ThreadService}
|
||||
*/
|
||||
@Inject
|
||||
public NettyNetworkService(ConfigurationService configService,
|
||||
Injector injector, ThreadService threadService) {
|
||||
public NettyNetworkService(Injector injector, ThreadService threadService) {
|
||||
super(NetworkServiceConfiguration.class);
|
||||
this.threadService = threadService;
|
||||
this.config = configService.get(NetworkConfiguration.class);
|
||||
this.injector = injector;
|
||||
InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.l2jserver.service.network;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import com.l2jserver.game.net.Lineage2Client;
|
||||
import com.l2jserver.game.net.Lineage2Session;
|
||||
@@ -25,9 +24,6 @@ import com.l2jserver.game.net.packet.ServerPacket;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.service.ServiceConfiguration;
|
||||
import com.l2jserver.service.configuration.Configuration;
|
||||
import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
|
||||
|
||||
/**
|
||||
* The network service is responsible for communicating the server with the game
|
||||
@@ -66,32 +62,6 @@ import com.l2jserver.service.configuration.XMLConfigurationService.Configuration
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface NetworkService extends Service {
|
||||
/**
|
||||
* The network {@link Configuration}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface NetworkConfiguration extends ServiceConfiguration {
|
||||
/**
|
||||
* Get the server listen address
|
||||
*
|
||||
* @return the listen address
|
||||
*/
|
||||
@ConfigurationPropertyGetter(defaultValue = "0.0.0.0:7777")
|
||||
@ConfigurationXPath("/configuration/services/network/listen")
|
||||
InetSocketAddress getListenAddress();
|
||||
|
||||
/**
|
||||
* Set the server listen address
|
||||
*
|
||||
* @param addr
|
||||
* the listen address
|
||||
*/
|
||||
@ConfigurationPropertySetter
|
||||
@ConfigurationXPath("/configuration/services/network/listen")
|
||||
void setListenAddress(InetSocketAddress addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new client
|
||||
*
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.service.network;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import com.l2jserver.service.ServiceConfiguration;
|
||||
import com.l2jserver.service.configuration.Configuration;
|
||||
import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
|
||||
|
||||
/**
|
||||
* The network {@link Configuration}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface NetworkServiceConfiguration extends ServiceConfiguration {
|
||||
/**
|
||||
* Get the server listen address
|
||||
*
|
||||
* @return the listen address
|
||||
*/
|
||||
@ConfigurationPropertyGetter(defaultValue = "0.0.0.0:7777")
|
||||
@ConfigurationXPath("server/@listen")
|
||||
InetSocketAddress getListenAddress();
|
||||
|
||||
/**
|
||||
* Set the server listen address
|
||||
*
|
||||
* @param addr
|
||||
* the listen address
|
||||
*/
|
||||
@ConfigurationPropertySetter
|
||||
@ConfigurationXPath("server/@listen")
|
||||
void setListenAddress(InetSocketAddress addr);
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Stage;
|
||||
import com.l2jserver.GameServerModule;
|
||||
import com.l2jserver.model.dao.CharacterDAO;
|
||||
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
@@ -47,7 +46,7 @@ public class MySQL5CharacterDAOTest {
|
||||
* The {@link Guice} {@link Injector}
|
||||
*/
|
||||
private final Injector injector = Guice.createInjector(Stage.PRODUCTION,
|
||||
new GameServerModule(), new AbstractModule() {
|
||||
new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(CharacterMapper.class);
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.ServiceManager;
|
||||
import com.l2jserver.service.ServiceModule;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.database.JDBCDAOModule;
|
||||
@@ -44,8 +43,8 @@ public class CharacterIDProviderTest {
|
||||
/**
|
||||
* The {@link Guice} {@link Injector}
|
||||
*/
|
||||
private final Injector injector = Guice.createInjector(new ServiceModule(),
|
||||
new JDBCDAOModule(), new IDProviderModule());
|
||||
private final Injector injector = Guice.createInjector(new JDBCDAOModule(),
|
||||
new IDProviderModule());
|
||||
/**
|
||||
* The character id provider
|
||||
*/
|
||||
@@ -53,6 +52,7 @@ public class CharacterIDProviderTest {
|
||||
|
||||
/**
|
||||
* Prepares the test
|
||||
*
|
||||
* @throws ServiceStartException
|
||||
*/
|
||||
@Before
|
||||
@@ -86,6 +86,7 @@ public class CharacterIDProviderTest {
|
||||
|
||||
/**
|
||||
* Tests DAO aware ids
|
||||
*
|
||||
* @throws ServiceStartException
|
||||
*/
|
||||
@Test
|
||||
|
||||
@@ -25,9 +25,9 @@ import org.junit.Test;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Stage;
|
||||
import com.l2jserver.GameServerModule;
|
||||
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
|
||||
import com.l2jserver.model.id.object.provider.ItemIDProvider;
|
||||
import com.l2jserver.model.id.provider.IDProviderModule;
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.item.ItemDropEvent;
|
||||
@@ -74,7 +74,7 @@ public class WorldEventDispatcherImplTest {
|
||||
@Before
|
||||
public void tearUp() throws ServiceStartException {
|
||||
Injector injector = Guice.createInjector(Stage.PRODUCTION,
|
||||
new GameServerModule());
|
||||
new IDProviderModule());
|
||||
|
||||
injector.getInstance(ServiceManager.class).start(WorldIDService.class);
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ import org.junit.Test;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.l2jserver.GameServerModule;
|
||||
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
|
||||
import com.l2jserver.model.id.provider.IDProviderModule;
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
@@ -36,6 +36,7 @@ import com.l2jserver.service.game.world.filter.impl.InstanceFilter;
|
||||
|
||||
/**
|
||||
* Tests for {@link WorldServiceImpl}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class WorldServiceImplTest {
|
||||
@@ -50,11 +51,12 @@ public class WorldServiceImplTest {
|
||||
|
||||
/**
|
||||
* Preparation for tests
|
||||
*
|
||||
* @throws ServiceStartException
|
||||
*/
|
||||
@Before
|
||||
public void tearUp() throws ServiceStartException {
|
||||
Injector injector = Guice.createInjector(new GameServerModule());
|
||||
Injector injector = Guice.createInjector(new IDProviderModule());
|
||||
|
||||
world = injector.getInstance(ServiceManager.class).start(
|
||||
WorldService.class);
|
||||
|
||||
Reference in New Issue
Block a user