mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
Server code and files reorganization
This commit is contained in:
@@ -1,4 +1,30 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# JDBCDatabaseService configuration
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Parameters in this file are used by JDBCDatabaseService.
|
||||||
|
# If you are not sure on the usage of any parameter, read the "Configuration"
|
||||||
|
# section in wiki article about "JDBCDatabaseService".
|
||||||
|
# https://github.com/l2jserver2/
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# NOTE: this is the development configuration file. Always remember to add
|
||||||
|
# new parameters to "dist/config" files too!
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# This defines the connection URL used by JDBC to connect to the database.
|
||||||
|
# Default: jdbc:mysql://localhost/l2jserver2
|
||||||
jdbc.url = jdbc:mysql://localhost/l2jserver2
|
jdbc.url = jdbc:mysql://localhost/l2jserver2
|
||||||
|
|
||||||
|
# The driver used to connect to the database. Please note that the driver
|
||||||
|
# library must be available in the JVM classpath.
|
||||||
|
# Default: com.mysql.jdbc.Driver in MySQL binary distribution or
|
||||||
|
# org.h2.Driver in H2 binary distribution
|
||||||
jdbc.driver = com.mysql.jdbc.Driver
|
jdbc.driver = com.mysql.jdbc.Driver
|
||||||
|
|
||||||
|
# The username used to login into the database.
|
||||||
|
# NOTE: Try not use "root" in production servers!
|
||||||
|
# Default: l2j
|
||||||
jdbc.username = l2j
|
jdbc.username = l2j
|
||||||
|
|
||||||
|
# The password used to login into the database.
|
||||||
|
# Default: changeme
|
||||||
jdbc.password = changeme
|
jdbc.password = changeme
|
||||||
@@ -1 +1,16 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# XMLTemplateService configuration
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Parameters in this file are used by XMLTemplateService.
|
||||||
|
# If you are not sure on the usage of any parameter, read the "Configuration"
|
||||||
|
# section in wiki article about "XMLTemplateService".
|
||||||
|
# https://github.com/l2jserver2/
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# NOTE: this is the development configuration file. Always remember to add
|
||||||
|
# new parameters to "dist/config" files too!
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The directory in which templates are located. All template files must be
|
||||||
|
# in .xml # file format. Must be relative to 'vfs.root' (vfs.properties)
|
||||||
|
# Default: data/templates
|
||||||
template.directory = data/templates
|
template.directory = data/templates
|
||||||
@@ -1 +1,15 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Java7VFSService configuration
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Parameters in this file are used by Java7VFSService.
|
||||||
|
# If you are not sure on the usage of any parameter, read the "Configuration"
|
||||||
|
# section in wiki article about "Java7VFSService".
|
||||||
|
# https://github.com/l2jserver2/
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# NOTE: this is the development configuration file. Always remember to add
|
||||||
|
# new parameters to "dist/config" files too!
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The root of the VFS, any file placed in "/" will go to specified path.
|
||||||
|
# Defaul: <empty> (will inherit from terminal working directory, if any)
|
||||||
vfs.root =
|
vfs.root =
|
||||||
31
dist/config/database.properties
vendored
31
dist/config/database.properties
vendored
@@ -1,4 +1,27 @@
|
|||||||
jdbc.mysql.url = jdbc:mysql://localhost/l2jserver2
|
# ---------------------------------------------------------------------------
|
||||||
jdbc.mysql.driver = com.mysql.jdbc.Driver
|
# JDBCDatabaseService configuration
|
||||||
jdbc.mysql.username = l2j
|
# ---------------------------------------------------------------------------
|
||||||
jdbc.mysql.password = changeme
|
# Parameters in this file are used by JDBCDatabaseService.
|
||||||
|
# If you are not sure on the usage of any parameter, read the "Configuration"
|
||||||
|
# section in wiki article about "JDBCDatabaseService".
|
||||||
|
# https://github.com/l2jserver2/
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# This defines the connection URL used by JDBC to connect to the database.
|
||||||
|
# Default: jdbc:mysql://localhost/l2jserver2
|
||||||
|
jdbc.url = jdbc:mysql://localhost/l2jserver2
|
||||||
|
|
||||||
|
# The driver used to connect to the database. Please note that the driver
|
||||||
|
# library must be available in the JVM classpath.
|
||||||
|
# Default: com.mysql.jdbc.Driver in MySQL binary distribution or
|
||||||
|
# org.h2.Driver in H2 binary distribution
|
||||||
|
jdbc.driver = com.mysql.jdbc.Driver
|
||||||
|
|
||||||
|
# The username used to login into the database.
|
||||||
|
# NOTE: Try not use "root" in production servers!
|
||||||
|
# Default: <your database username>
|
||||||
|
jdbc.username = l2j
|
||||||
|
|
||||||
|
# The password used to login into the database.
|
||||||
|
# Default: <your database password>
|
||||||
|
jdbc.password = changeme
|
||||||
12
dist/config/template.properties
vendored
12
dist/config/template.properties
vendored
@@ -1 +1,13 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# XMLTemplateService configuration
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Parameters in this file are used by XMLTemplateService.
|
||||||
|
# If you are not sure on the usage of any parameter, read the "Configuration"
|
||||||
|
# section in wiki article about "XMLTemplateService".
|
||||||
|
# https://github.com/l2jserver2/
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The directory in which templates are located. All template files must be
|
||||||
|
# in .xml # file format. Must be relative to 'vfs.root' (vfs.properties)
|
||||||
|
# Default: data/templates
|
||||||
template.directory = data/templates
|
template.directory = data/templates
|
||||||
11
dist/config/vfs.properties
vendored
11
dist/config/vfs.properties
vendored
@@ -1 +1,12 @@
|
|||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Java7VFSService configuration
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Parameters in this file are used by Java7VFSService.
|
||||||
|
# If you are not sure on the usage of any parameter, read the "Configuration"
|
||||||
|
# section in wiki article about "Java7VFSService".
|
||||||
|
# https://github.com/l2jserver2/
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# The root of the VFS, any file placed in "/" will go to specified path.
|
||||||
|
# Defaul: <empty> (will inherit from terminal working directory, if any)
|
||||||
vfs.root =
|
vfs.root =
|
||||||
@@ -29,7 +29,7 @@ import com.l2jserver.service.database.DataAccessObject;
|
|||||||
* The {@link CharacterDAO} is can load and save {@link Character character
|
* The {@link CharacterDAO} is can load and save {@link Character character
|
||||||
* instances} .
|
* instances} .
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface CharacterDAO extends
|
public interface CharacterDAO extends
|
||||||
DataAccessObject<L2Character, CharacterID>, Cacheable {
|
DataAccessObject<L2Character, CharacterID>, Cacheable {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.l2jserver.service.database.DataAccessObject;
|
|||||||
* The {@link CharacterFriendDAO} is can load and save
|
* The {@link CharacterFriendDAO} is can load and save
|
||||||
* {@link CharacterFriendList character friend list}.
|
* {@link CharacterFriendList character friend list}.
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface CharacterFriendDAO extends
|
public interface CharacterFriendDAO extends
|
||||||
DataAccessObject<CharacterFriend, FriendID>, Cacheable {
|
DataAccessObject<CharacterFriend, FriendID>, Cacheable {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import com.l2jserver.service.database.DataAccessObject;
|
|||||||
* The {@link ChatMessageDAO} is can load and save {@link ChatMessage chat
|
* The {@link ChatMessageDAO} is can load and save {@link ChatMessage chat
|
||||||
* messages}.
|
* messages}.
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface ChatMessageDAO extends
|
public interface ChatMessageDAO extends
|
||||||
DataAccessObject<ChatMessage, ChatMessageID>, Cacheable {
|
DataAccessObject<ChatMessage, ChatMessageID>, Cacheable {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.l2jserver.service.database.DataAccessObject;
|
|||||||
/**
|
/**
|
||||||
* The {@link ClanDAO} is can load and save {@link Clan clan instances}.
|
* The {@link ClanDAO} is can load and save {@link Clan clan instances}.
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface ClanDAO extends DataAccessObject<Clan, ClanID>, Cacheable {
|
public interface ClanDAO extends DataAccessObject<Clan, ClanID>, Cacheable {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import com.l2jserver.service.database.DataAccessObject;
|
|||||||
* The {@link ItemDAO} is can load and save {@link Character character
|
* The {@link ItemDAO} is can load and save {@link Character character
|
||||||
* instances} .
|
* instances} .
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface ItemDAO extends DataAccessObject<Item, ItemID>, Cacheable {
|
public interface ItemDAO extends DataAccessObject<Item, ItemID>, Cacheable {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import com.l2jserver.service.database.DataAccessObject;
|
|||||||
/**
|
/**
|
||||||
* The {@link NPCDAO} is can load and save {@link NPC NPC instances}.
|
* The {@link NPCDAO} is can load and save {@link NPC NPC instances}.
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface NPCDAO extends DataAccessObject<NPC, NPCID>, Cacheable {
|
public interface NPCDAO extends DataAccessObject<NPC, NPCID>, Cacheable {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.l2jserver.service.database.DataAccessObject;
|
|||||||
/**
|
/**
|
||||||
* The {@link PetDAO} is can load and save {@link Pet pet instances}.
|
* The {@link PetDAO} is can load and save {@link Pet pet instances}.
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface PetDAO extends DataAccessObject<Pet, PetID>, Cacheable {
|
public interface PetDAO extends DataAccessObject<Pet, PetID>, Cacheable {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.l2jserver.model.id.ObjectID;
|
|||||||
/**
|
/**
|
||||||
* This is an abstract object representing all the world objects in Lineage II.
|
* This is an abstract object representing all the world objects in Lineage II.
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractObject extends AbstractModel<ObjectID<?>>
|
public abstract class AbstractObject extends AbstractModel<ObjectID<?>>
|
||||||
implements WorldObject {
|
implements WorldObject {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.l2jserver.model.id.template.ActorTemplateID;
|
|||||||
* {@link Player} is any object that can be controlled by the player. The most
|
* {@link Player} is any object that can be controlled by the player. The most
|
||||||
* common implementation is {@link L2Character}.
|
* common implementation is {@link L2Character}.
|
||||||
*
|
*
|
||||||
* @author Rogiel
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public abstract class Player extends Actor {
|
public abstract class Player extends Actor {
|
||||||
public Player(ActorTemplateID<?> templateID) {
|
public Player(ActorTemplateID<?> templateID) {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of l2jserver <l2jserver.com>.
|
|
||||||
*
|
|
||||||
* l2jserver 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.
|
|
||||||
*
|
|
||||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.l2jserver.service.core.vfs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration interface for {@link Java7VFSService}.
|
|
||||||
*
|
|
||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
|
||||||
*/
|
|
||||||
public interface Java7VFSConfiguration extends VFSConfiguration {
|
|
||||||
}
|
|
||||||
@@ -54,6 +54,14 @@ public class Java7VFSService extends AbstractService implements VFSService {
|
|||||||
*/
|
*/
|
||||||
private Path root;
|
private Path root;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration interface for {@link Java7VFSService}.
|
||||||
|
*
|
||||||
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
|
*/
|
||||||
|
public interface Java7VFSConfiguration extends VFSConfiguration {
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected Java7VFSService(final ConfigurationService configService) {
|
protected Java7VFSService(final ConfigurationService configService) {
|
||||||
this.config = configService.get(Java7VFSConfiguration.class);
|
this.config = configService.get(Java7VFSConfiguration.class);
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of l2jserver <l2jserver.com>.
|
|
||||||
*
|
|
||||||
* l2jserver 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.
|
|
||||||
*
|
|
||||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.l2jserver.service.core.vfs;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
|
|
||||||
import com.l2jserver.service.configuration.Configuration;
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VFS service configuration
|
|
||||||
*
|
|
||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
|
||||||
* @see Configuration
|
|
||||||
*/
|
|
||||||
@ConfigurationName("vfs")
|
|
||||||
public interface VFSConfiguration extends Configuration {
|
|
||||||
/**
|
|
||||||
* @return the VFS root {@link URI}
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "vfs.root", defaultValue = "")
|
|
||||||
Path getRoot();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param root
|
|
||||||
* the new VFS root {@link URI}
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "vfs.root")
|
|
||||||
void setRoot(Path root);
|
|
||||||
}
|
|
||||||
@@ -16,9 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jserver.service.core.vfs;
|
package com.l2jserver.service.core.vfs;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
import com.l2jserver.service.Service;
|
import com.l2jserver.service.Service;
|
||||||
|
import com.l2jserver.service.configuration.Configuration;
|
||||||
|
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The VFS service is responsible for creating a Virtual File System that is
|
* The VFS service is responsible for creating a Virtual File System that is
|
||||||
@@ -27,6 +30,28 @@ import com.l2jserver.service.Service;
|
|||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface VFSService extends Service {
|
public interface VFSService extends Service {
|
||||||
|
/**
|
||||||
|
* VFS service configuration
|
||||||
|
*
|
||||||
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
|
* @see Configuration
|
||||||
|
*/
|
||||||
|
@ConfigurationName("vfs")
|
||||||
|
public interface VFSConfiguration extends Configuration {
|
||||||
|
/**
|
||||||
|
* @return the VFS root {@link URI}
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "vfs.root", defaultValue = "")
|
||||||
|
Path getRoot();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param root
|
||||||
|
* the new VFS root {@link URI}
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "vfs.root")
|
||||||
|
void setRoot(Path root);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves an file. If the file cannot be resolved, null will be returned.
|
* Resolves an file. If the file cannot be resolved, null will be returned.
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of l2jserver <l2jserver.com>.
|
|
||||||
*
|
|
||||||
* l2jserver 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.
|
|
||||||
*
|
|
||||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
import com.l2jserver.service.configuration.Configuration;
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Database service configuration
|
|
||||||
*
|
|
||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
|
||||||
* @see Configuration
|
|
||||||
*/
|
|
||||||
@ConfigurationName("database")
|
|
||||||
public interface DatabaseConfiguration extends Configuration {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,6 +19,8 @@ package com.l2jserver.service.database;
|
|||||||
import com.l2jserver.model.Model;
|
import com.l2jserver.model.Model;
|
||||||
import com.l2jserver.model.id.ID;
|
import com.l2jserver.model.id.ID;
|
||||||
import com.l2jserver.service.Service;
|
import com.l2jserver.service.Service;
|
||||||
|
import com.l2jserver.service.configuration.Configuration;
|
||||||
|
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This service provides access to an database implementation. Each
|
* This service provides access to an database implementation. Each
|
||||||
@@ -36,6 +38,16 @@ import com.l2jserver.service.Service;
|
|||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface DatabaseService extends Service {
|
public interface DatabaseService extends Service {
|
||||||
|
/**
|
||||||
|
* Database service configuration
|
||||||
|
*
|
||||||
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
|
* @see Configuration
|
||||||
|
*/
|
||||||
|
@ConfigurationName("database")
|
||||||
|
public interface DatabaseConfiguration extends Configuration {
|
||||||
|
}
|
||||||
|
|
||||||
<M extends Model<I>, I extends ID<M>> DataAccessObject<M, I> getDAO(
|
<M extends Model<I>, I extends ID<M>> DataAccessObject<M, I> getDAO(
|
||||||
Class<M> model);
|
Class<M> model);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of l2jserver <l2jserver.com>.
|
|
||||||
*
|
|
||||||
* l2jserver 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.
|
|
||||||
*
|
|
||||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration interface for {@link JDBCDatabaseService}.
|
|
||||||
*
|
|
||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
|
||||||
*/
|
|
||||||
public interface JDBCDatabaseConfiguration extends DatabaseConfiguration {
|
|
||||||
/**
|
|
||||||
* @return the jdbc url
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.url", defaultValue = "jdbc:mysql://localhost/l2jserver2")
|
|
||||||
String getJdbcUrl();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param jdbcUrl
|
|
||||||
* the new jdbc url
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.url")
|
|
||||||
void setJdbcUrl(String jdbcUrl);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the jdbc driver class
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.driver", defaultValue = "com.jdbc.jdbc.Driver")
|
|
||||||
String getDriver();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param driver
|
|
||||||
* the new jdbc driver
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.driver")
|
|
||||||
void setDriver(Class<?> driver);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the jdbc database username
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.username", defaultValue = "l2j")
|
|
||||||
String getUsername();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param username
|
|
||||||
* the jdbc database username
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.username")
|
|
||||||
void setUsername(String username);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the jdbc database password
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.password", defaultValue = "changeme")
|
|
||||||
String getPassword();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param password
|
|
||||||
* the jdbc database password
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.password")
|
|
||||||
void setPassword(String password);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the maximum number of active connections
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.active.max", defaultValue = "20")
|
|
||||||
int getMaxActiveConnections();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param password
|
|
||||||
* the maximum number of active connections
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.active.max")
|
|
||||||
void setMaxActiveConnections(int password);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the maximum number of idle connections
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.idle.max", defaultValue = "20")
|
|
||||||
int getMaxIdleConnections();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param password
|
|
||||||
* the maximum number of idle connections
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.idle.max")
|
|
||||||
void setMaxIdleConnections(int password);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the minimum number of idle connections
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.idle.min", defaultValue = "5")
|
|
||||||
int getMinIdleConnections();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param password
|
|
||||||
* the minimum number of idle connections
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.idle.min")
|
|
||||||
void setMinIdleConnections(int password);
|
|
||||||
}
|
|
||||||
@@ -145,6 +145,104 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
*/
|
*/
|
||||||
private ScheduledAsyncFuture autoSaveFuture;
|
private ScheduledAsyncFuture autoSaveFuture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configuration interface for {@link JDBCDatabaseService}.
|
||||||
|
*
|
||||||
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
|
*/
|
||||||
|
public interface JDBCDatabaseConfiguration extends DatabaseConfiguration {
|
||||||
|
/**
|
||||||
|
* @return the jdbc url
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "jdbc.url", defaultValue = "jdbc:mysql://localhost/l2jserver2")
|
||||||
|
String getJdbcUrl();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jdbcUrl
|
||||||
|
* the new jdbc url
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "jdbc.url")
|
||||||
|
void setJdbcUrl(String jdbcUrl);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the jdbc driver class
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "jdbc.driver", defaultValue = "com.jdbc.jdbc.Driver")
|
||||||
|
String getDriver();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param driver
|
||||||
|
* the new jdbc driver
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "jdbc.driver")
|
||||||
|
void setDriver(Class<?> driver);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the jdbc database username
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "jdbc.username", defaultValue = "l2j")
|
||||||
|
String getUsername();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param username
|
||||||
|
* the jdbc database username
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "jdbc.username")
|
||||||
|
void setUsername(String username);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the jdbc database password
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "jdbc.password", defaultValue = "changeme")
|
||||||
|
String getPassword();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param password
|
||||||
|
* the jdbc database password
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "jdbc.password")
|
||||||
|
void setPassword(String password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the maximum number of active connections
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "jdbc.active.max", defaultValue = "20")
|
||||||
|
int getMaxActiveConnections();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param password
|
||||||
|
* the maximum number of active connections
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "jdbc.active.max")
|
||||||
|
void setMaxActiveConnections(int password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the maximum number of idle connections
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "jdbc.idle.max", defaultValue = "20")
|
||||||
|
int getMaxIdleConnections();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param password
|
||||||
|
* the maximum number of idle connections
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "jdbc.idle.max")
|
||||||
|
void setMaxIdleConnections(int password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the minimum number of idle connections
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "jdbc.idle.min", defaultValue = "5")
|
||||||
|
int getMinIdleConnections();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param password
|
||||||
|
* the minimum number of idle connections
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "jdbc.idle.min")
|
||||||
|
void setMinIdleConnections(int password);
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public JDBCDatabaseService(ConfigurationService configService,
|
public JDBCDatabaseService(ConfigurationService configService,
|
||||||
Injector injector, CacheService cacheService,
|
Injector injector, CacheService cacheService,
|
||||||
@@ -331,7 +429,7 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
*/
|
*/
|
||||||
private final Logger log = LoggerFactory
|
private final Logger log = LoggerFactory
|
||||||
.getLogger(InsertUpdateQuery.class);
|
.getLogger(InsertUpdateQuery.class);
|
||||||
|
|
||||||
private final Iterator<T> iterator;
|
private final Iterator<T> iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -358,24 +456,25 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
@Override
|
@Override
|
||||||
public Integer query(Connection conn) throws SQLException {
|
public Integer query(Connection conn) throws SQLException {
|
||||||
Preconditions.checkNotNull(conn, "conn");
|
Preconditions.checkNotNull(conn, "conn");
|
||||||
|
|
||||||
log.debug("Starting INSERT/UPDATE query execution");
|
log.debug("Starting INSERT/UPDATE query execution");
|
||||||
|
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final T object = iterator.next();
|
final T object = iterator.next();
|
||||||
final String queryString = query();
|
final String queryString = query();
|
||||||
|
|
||||||
log.debug("Preparing statement for {}: {}", object, queryString);
|
log.debug("Preparing statement for {}: {}", object, queryString);
|
||||||
final PreparedStatement st = conn.prepareStatement(queryString,
|
final PreparedStatement st = conn.prepareStatement(queryString,
|
||||||
Statement.RETURN_GENERATED_KEYS);
|
Statement.RETURN_GENERATED_KEYS);
|
||||||
|
|
||||||
log.debug("Parametizing statement {} with {}", st, object);
|
log.debug("Parametizing statement {} with {}", st, object);
|
||||||
this.parametize(st, object);
|
this.parametize(st, object);
|
||||||
|
|
||||||
log.debug("Sending query to database for {}", object);
|
log.debug("Sending query to database for {}", object);
|
||||||
rows += st.executeUpdate();
|
rows += st.executeUpdate();
|
||||||
log.debug("Query inserted or updated {} rows for {}", rows, object);
|
log.debug("Query inserted or updated {} rows for {}", rows,
|
||||||
|
object);
|
||||||
|
|
||||||
// update object desire --it has been realized
|
// update object desire --it has been realized
|
||||||
if (object instanceof Model && rows > 0) {
|
if (object instanceof Model && rows > 0) {
|
||||||
@@ -386,10 +485,12 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
if (mapper == null)
|
if (mapper == null)
|
||||||
continue;
|
continue;
|
||||||
final ResultSet rs = st.getGeneratedKeys();
|
final ResultSet rs = st.getGeneratedKeys();
|
||||||
log.debug("Mapping generated keys with {} using {}", mapper, rs);
|
log.debug("Mapping generated keys with {} using {}",
|
||||||
|
mapper, rs);
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
final ID<?> generatedID = mapper.map(rs);
|
final ID<?> generatedID = mapper.map(rs);
|
||||||
log.debug("Generated ID for {} is {}", object, generatedID);
|
log.debug("Generated ID for {} is {}", object,
|
||||||
|
generatedID);
|
||||||
((Model<ID<?>>) object).setID(generatedID);
|
((Model<ID<?>>) object).setID(generatedID);
|
||||||
mapper.map(rs);
|
mapper.map(rs);
|
||||||
}
|
}
|
||||||
@@ -444,23 +545,23 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
*/
|
*/
|
||||||
private final Logger log = LoggerFactory
|
private final Logger log = LoggerFactory
|
||||||
.getLogger(SelectListQuery.class);
|
.getLogger(SelectListQuery.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<T> query(Connection conn) throws SQLException {
|
public List<T> query(Connection conn) throws SQLException {
|
||||||
Preconditions.checkNotNull(conn, "conn");
|
Preconditions.checkNotNull(conn, "conn");
|
||||||
|
|
||||||
log.debug("Starting SELECT List<?> query execution");
|
log.debug("Starting SELECT List<?> query execution");
|
||||||
|
|
||||||
final String queryString = query();
|
final String queryString = query();
|
||||||
log.debug("Preparing statement with {}", queryString);
|
log.debug("Preparing statement with {}", queryString);
|
||||||
final PreparedStatement st = conn.prepareStatement(query());
|
final PreparedStatement st = conn.prepareStatement(query());
|
||||||
|
|
||||||
log.debug("Parametizing statement {}", st);
|
log.debug("Parametizing statement {}", st);
|
||||||
parametize(st);
|
parametize(st);
|
||||||
|
|
||||||
log.debug("Sending query to database for {}", st);
|
log.debug("Sending query to database for {}", st);
|
||||||
st.execute();
|
st.execute();
|
||||||
|
|
||||||
final List<T> list = CollectionFactory.newList();
|
final List<T> list = CollectionFactory.newList();
|
||||||
final ResultSet rs = st.getResultSet();
|
final ResultSet rs = st.getResultSet();
|
||||||
final Mapper<T> mapper = mapper();
|
final Mapper<T> mapper = mapper();
|
||||||
@@ -526,23 +627,23 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
*/
|
*/
|
||||||
private final Logger log = LoggerFactory
|
private final Logger log = LoggerFactory
|
||||||
.getLogger(SelectSingleQuery.class);
|
.getLogger(SelectSingleQuery.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T query(Connection conn) throws SQLException {
|
public T query(Connection conn) throws SQLException {
|
||||||
Preconditions.checkNotNull(conn, "conn");
|
Preconditions.checkNotNull(conn, "conn");
|
||||||
|
|
||||||
log.debug("Starting SELECT single query execution");
|
log.debug("Starting SELECT single query execution");
|
||||||
|
|
||||||
final String queryString = query();
|
final String queryString = query();
|
||||||
log.debug("Preparing statement with {}", queryString);
|
log.debug("Preparing statement with {}", queryString);
|
||||||
final PreparedStatement st = conn.prepareStatement(query());
|
final PreparedStatement st = conn.prepareStatement(query());
|
||||||
|
|
||||||
log.debug("Parametizing statement {}", st);
|
log.debug("Parametizing statement {}", st);
|
||||||
parametize(st);
|
parametize(st);
|
||||||
|
|
||||||
log.debug("Sending query to database for {}", st);
|
log.debug("Sending query to database for {}", st);
|
||||||
st.execute();
|
st.execute();
|
||||||
|
|
||||||
final ResultSet rs = st.getResultSet();
|
final ResultSet rs = st.getResultSet();
|
||||||
final Mapper<T> mapper = mapper();
|
final Mapper<T> mapper = mapper();
|
||||||
log.debug("Database returned {}", rs);
|
log.debug("Database returned {}", rs);
|
||||||
@@ -630,7 +731,7 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
*/
|
*/
|
||||||
private final Logger log = LoggerFactory
|
private final Logger log = LoggerFactory
|
||||||
.getLogger(SelectSingleQuery.class);
|
.getLogger(SelectSingleQuery.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database service instance
|
* The database service instance
|
||||||
*/
|
*/
|
||||||
@@ -655,12 +756,12 @@ public class JDBCDatabaseService extends AbstractService implements
|
|||||||
log.debug("Mapping row {} ID with {}", rs, idMapper);
|
log.debug("Mapping row {} ID with {}", rs, idMapper);
|
||||||
final I id = idMapper.map(rs);
|
final I id = idMapper.map(rs);
|
||||||
Preconditions.checkNotNull(id, "id");
|
Preconditions.checkNotNull(id, "id");
|
||||||
|
|
||||||
log.debug("ID={}, locating cached object", id);
|
log.debug("ID={}, locating cached object", id);
|
||||||
|
|
||||||
if (database.hasCachedObject(id))
|
if (database.hasCachedObject(id))
|
||||||
return (T) database.getCachedObject(id);
|
return (T) database.getCachedObject(id);
|
||||||
|
|
||||||
log.debug("Cached object not found, creating...");
|
log.debug("Cached object not found, creating...");
|
||||||
|
|
||||||
final T object = map(id, rs);
|
final T object = map(id, rs);
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of l2jserver <l2jserver.com>.
|
|
||||||
*
|
|
||||||
* l2jserver 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.
|
|
||||||
*
|
|
||||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.l2jserver.service.game.template;
|
|
||||||
|
|
||||||
public class TemplateException extends RuntimeException {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public TemplateException() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TemplateException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TemplateException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TemplateException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,6 +18,7 @@ package com.l2jserver.service.game.template;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
import java.nio.file.FileVisitResult;
|
import java.nio.file.FileVisitResult;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@@ -52,6 +53,8 @@ import com.l2jserver.service.ServiceStartException;
|
|||||||
import com.l2jserver.service.ServiceStopException;
|
import com.l2jserver.service.ServiceStopException;
|
||||||
import com.l2jserver.service.cache.Cache;
|
import com.l2jserver.service.cache.Cache;
|
||||||
import com.l2jserver.service.cache.CacheService;
|
import com.l2jserver.service.cache.CacheService;
|
||||||
|
import com.l2jserver.service.configuration.Configuration;
|
||||||
|
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||||
import com.l2jserver.service.configuration.ConfigurationService;
|
import com.l2jserver.service.configuration.ConfigurationService;
|
||||||
import com.l2jserver.service.core.LoggingService;
|
import com.l2jserver.service.core.LoggingService;
|
||||||
import com.l2jserver.service.core.vfs.VFSService;
|
import com.l2jserver.service.core.vfs.VFSService;
|
||||||
@@ -82,6 +85,15 @@ public class XMLTemplateService extends AbstractService implements
|
|||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private Cache<TemplateID, Template> templates;
|
private Cache<TemplateID, Template> templates;
|
||||||
|
|
||||||
|
@ConfigurationName("template")
|
||||||
|
public interface XMLTemplateServiceConfiguration extends Configuration {
|
||||||
|
@ConfigurationPropertyGetter(name = "template.directory", defaultValue = "data/templates")
|
||||||
|
URI getTemplateDirectory();
|
||||||
|
|
||||||
|
@ConfigurationPropertySetter(name = "template.directory")
|
||||||
|
void setTemplateDirectory(URI file);
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public XMLTemplateService(final VFSService vfsService,
|
public XMLTemplateService(final VFSService vfsService,
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of l2jserver <l2jserver.com>.
|
|
||||||
*
|
|
||||||
* l2jserver 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.
|
|
||||||
*
|
|
||||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.l2jserver.service.game.template;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
import com.l2jserver.service.configuration.Configuration;
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
|
||||||
|
|
||||||
@ConfigurationName("template")
|
|
||||||
public interface XMLTemplateServiceConfiguration extends Configuration {
|
|
||||||
@ConfigurationPropertyGetter(name = "template.directory", defaultValue = "data/templates")
|
|
||||||
URI getTemplateDirectory();
|
|
||||||
|
|
||||||
@ConfigurationPropertySetter(name = "template.directory")
|
|
||||||
void setTemplateDirectory(URI file);
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of l2jserver <l2jserver.com>.
|
|
||||||
*
|
|
||||||
* l2jserver 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.
|
|
||||||
*
|
|
||||||
* l2jserver 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 l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
package com.l2jserver.service.network;
|
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
|
|
||||||
import com.l2jserver.service.configuration.Configuration;
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The network {@link Configuration}
|
|
||||||
*
|
|
||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
|
||||||
*/
|
|
||||||
@ConfigurationName("network")
|
|
||||||
public interface NetworkConfiguration extends Configuration {
|
|
||||||
// TODO set default value
|
|
||||||
/**
|
|
||||||
* Get the server listen address
|
|
||||||
*
|
|
||||||
* @return the listen address
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "listen", defaultValue = "0.0.0.0:7777")
|
|
||||||
InetSocketAddress getListenAddress();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the server listen address
|
|
||||||
*
|
|
||||||
* @param addr
|
|
||||||
* the listen address
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "listen")
|
|
||||||
void setListenAddress(InetSocketAddress addr);
|
|
||||||
}
|
|
||||||
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jserver.service.network;
|
package com.l2jserver.service.network;
|
||||||
|
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
import com.l2jserver.game.net.Lineage2Client;
|
import com.l2jserver.game.net.Lineage2Client;
|
||||||
import com.l2jserver.game.net.Lineage2Session;
|
import com.l2jserver.game.net.Lineage2Session;
|
||||||
import com.l2jserver.game.net.packet.ClientPacket;
|
import com.l2jserver.game.net.packet.ClientPacket;
|
||||||
@@ -23,6 +25,8 @@ import com.l2jserver.game.net.packet.ServerPacket;
|
|||||||
import com.l2jserver.model.id.object.CharacterID;
|
import com.l2jserver.model.id.object.CharacterID;
|
||||||
import com.l2jserver.model.world.L2Character;
|
import com.l2jserver.model.world.L2Character;
|
||||||
import com.l2jserver.service.Service;
|
import com.l2jserver.service.Service;
|
||||||
|
import com.l2jserver.service.configuration.Configuration;
|
||||||
|
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The network service is responsible for communicating the server with the game
|
* The network service is responsible for communicating the server with the game
|
||||||
@@ -61,6 +65,32 @@ import com.l2jserver.service.Service;
|
|||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public interface NetworkService extends Service {
|
public interface NetworkService extends Service {
|
||||||
|
/**
|
||||||
|
* The network {@link Configuration}
|
||||||
|
*
|
||||||
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
|
*/
|
||||||
|
@ConfigurationName("network")
|
||||||
|
public interface NetworkConfiguration extends Configuration {
|
||||||
|
/**
|
||||||
|
* Get the server listen address
|
||||||
|
*
|
||||||
|
* @return the listen address
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertyGetter(name = "listen", defaultValue = "0.0.0.0:7777")
|
||||||
|
InetSocketAddress getListenAddress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the server listen address
|
||||||
|
*
|
||||||
|
* @param addr
|
||||||
|
* the listen address
|
||||||
|
*/
|
||||||
|
@ConfigurationPropertySetter(name = "listen")
|
||||||
|
void setListenAddress(InetSocketAddress addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a new client
|
* Registers a new client
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user