.
+ *
+ * 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 .
+ */
+package com.l2jserver.service.core.vfs;
+
+import java.net.URI;
+import java.nio.file.Path;
+
+import com.l2jserver.service.ServiceConfiguration;
+import com.l2jserver.service.configuration.Configuration;
+import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
+
+/**
+ * VFS service configuration
+ *
+ * @author Rogiel
+ * @see Configuration
+ */
+public interface VFSConfiguration extends ServiceConfiguration {
+ /**
+ * @return the VFS root {@link URI}
+ */
+ @ConfigurationPropertyGetter(defaultValue = "")
+ @ConfigurationXPath("fileSystem/@root")
+ Path getRoot();
+
+ /**
+ * @param root
+ * the new VFS root {@link URI}
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("fileSystem/@root")
+ void setRoot(Path root);
+
+ /**
+ * @return the VFS root {@link URI}
+ */
+ @ConfigurationPropertyGetter(defaultValue = "")
+ @ConfigurationXPath("fileSystem/data/@root")
+ String getDataPath();
+
+ /**
+ * @param data
+ * the new data root {@link URI}
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("fileSystem/data/@root")
+ void setDataPath(String data);
+}
\ No newline at end of file
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/core/vfs/VFSService.java b/l2jserver2-common/src/main/java/com/l2jserver/service/core/vfs/VFSService.java
index bfb5bcca6..d0853d100 100644
--- a/l2jserver2-common/src/main/java/com/l2jserver/service/core/vfs/VFSService.java
+++ b/l2jserver2-common/src/main/java/com/l2jserver/service/core/vfs/VFSService.java
@@ -16,13 +16,9 @@
*/
package com.l2jserver.service.core.vfs;
-import java.net.URI;
import java.nio.file.Path;
import com.l2jserver.service.Service;
-import com.l2jserver.service.ServiceConfiguration;
-import com.l2jserver.service.configuration.Configuration;
-import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
/**
* The VFS service is responsible for creating a Virtual File System that is
@@ -31,44 +27,6 @@ import com.l2jserver.service.configuration.XMLConfigurationService.Configuration
* @author Rogiel
*/
public interface VFSService extends Service {
- /**
- * VFS service configuration
- *
- * @author Rogiel
- * @see Configuration
- */
- public interface VFSConfiguration extends ServiceConfiguration {
- /**
- * @return the VFS root {@link URI}
- */
- @ConfigurationPropertyGetter(defaultValue = "")
- @ConfigurationXPath("/configuration/services/vfs/root")
- Path getRoot();
-
- /**
- * @param root
- * the new VFS root {@link URI}
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/vfs/root")
- void setRoot(Path root);
-
- /**
- * @return the VFS root {@link URI}
- */
- @ConfigurationPropertyGetter(defaultValue = "")
- @ConfigurationXPath("/configuration/services/vfs/data")
- String getDataPath();
-
- /**
- * @param data
- * the new data root {@link URI}
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/vfs/data")
- void setDataPath(String data);
- }
-
/**
* Resolves an file. If the file cannot be resolved, null will be returned.
*
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseConfiguration.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseConfiguration.java
new file mode 100644
index 000000000..085bebbd1
--- /dev/null
+++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseConfiguration.java
@@ -0,0 +1,44 @@
+/*
+ * This file is part of l2jserver2 .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.database;
+
+import com.l2jserver.service.ServiceConfiguration;
+import com.l2jserver.service.configuration.Configuration;
+import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
+
+/**
+ * Database service configuration
+ *
+ * @author Rogiel
+ * @see Configuration
+ */
+public interface DatabaseConfiguration extends ServiceConfiguration {
+ /**
+ * @return the update schema state
+ */
+ @ConfigurationPropertyGetter(defaultValue = "true")
+ @ConfigurationXPath("schema/@automaticUpdate")
+ boolean isAutomaticSchemaUpdateEnabled();
+
+ /**
+ * @param updateSchema
+ * the new uodate schema state
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("schema/@automaticUpdate")
+ void setUpdateSchema(boolean updateSchema);
+}
\ No newline at end of file
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseService.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseService.java
index 75d4d1563..a6677e3e0 100644
--- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseService.java
+++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/DatabaseService.java
@@ -22,9 +22,6 @@ import java.nio.file.Path;
import com.l2jserver.model.Model;
import com.l2jserver.model.id.ID;
import com.l2jserver.service.Service;
-import com.l2jserver.service.ServiceConfiguration;
-import com.l2jserver.service.configuration.Configuration;
-import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
import com.l2jserver.service.core.threading.AsyncFuture;
import com.mysema.query.sql.RelationalPath;
import com.mysema.query.sql.RelationalPathBase;
@@ -45,29 +42,6 @@ import com.mysema.query.sql.RelationalPathBase;
* @author Rogiel
*/
public interface DatabaseService extends Service {
- /**
- * Database service configuration
- *
- * @author Rogiel
- * @see Configuration
- */
- public interface DatabaseConfiguration extends ServiceConfiguration {
- /**
- * @return the update schema state
- */
- @ConfigurationPropertyGetter(defaultValue = "true")
- @ConfigurationXPath("/configuration/services/database/automaticSchemaUpdate")
- boolean isAutomaticSchemaUpdateEnabled();
-
- /**
- * @param updateSchema
- * the new uodate schema state
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/automaticSchemaUpdate")
- void setUpdateSchema(boolean updateSchema);
- }
-
/**
* Executes several operations inside a single database transaction.
*
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java
index 53e5c9711..9d68967fa 100644
--- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java
+++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/AbstractOrientDatabaseService.java
@@ -35,13 +35,11 @@ import com.l2jserver.model.Model;
import com.l2jserver.model.Model.ObjectDesire;
import com.l2jserver.model.id.ID;
import com.l2jserver.model.id.object.allocator.IDAllocator;
-import com.l2jserver.service.AbstractService;
+import com.l2jserver.service.AbstractConfigurableService;
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.threading.AbstractTask;
import com.l2jserver.service.core.threading.AsyncFuture;
import com.l2jserver.service.core.threading.ScheduledAsyncFuture;
@@ -96,12 +94,9 @@ import com.orientechnologies.orient.core.tx.OTransaction;
*
* @author Rogiel
*/
-public abstract class AbstractOrientDatabaseService extends AbstractService
- implements DatabaseService {
- /**
- * The configuration object
- */
- private final OrientDatabaseConfiguration config;
+public abstract class AbstractOrientDatabaseService extends
+ AbstractConfigurableService implements
+ DatabaseService {
/**
* The logger
*/
@@ -136,60 +131,6 @@ public abstract class AbstractOrientDatabaseService extends AbstractService
private final ThreadLocal transaction = new ThreadLocal();
/**
- * Configuration interface for {@link AbstractOrientDatabaseService}.
- *
- * @author Rogiel
- */
- public interface OrientDatabaseConfiguration extends DatabaseConfiguration {
- /**
- * @return the orientdb url
- */
- @ConfigurationPropertyGetter(defaultValue = "local:data/database")
- @ConfigurationXPath("/configuration/services/database/orientdb/url")
- String getUrl();
-
- /**
- * @param url
- * the new orientdb url
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/orientdb/url")
- void setUrl(String url);
-
- /**
- * @return the orientdb database username
- */
- @ConfigurationPropertyGetter(defaultValue = "admin")
- @ConfigurationXPath("/configuration/services/database/orientdb/username")
- String getUsername();
-
- /**
- * @param username
- * the orientdb database username
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/orientdb/username")
- void setUsername(String username);
-
- /**
- * @return the orientdb database password
- */
- @ConfigurationPropertyGetter(defaultValue = "admin")
- @ConfigurationXPath("/configuration/services/database/orientdb/password")
- String getPassword();
-
- /**
- * @param password
- * the jdbc database password
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/jdbc/password")
- void setPassword(String password);
- }
-
- /**
- * @param configService
- * the configuration service
* @param cacheService
* the cache service
* @param threadService
@@ -198,10 +139,10 @@ public abstract class AbstractOrientDatabaseService extends AbstractService
* the {@link DataAccessObject DAO} resolver
*/
@Inject
- public AbstractOrientDatabaseService(ConfigurationService configService,
+ public AbstractOrientDatabaseService(
CacheService cacheService, ThreadService threadService,
DAOResolver daoResolver) {
- config = configService.get(OrientDatabaseConfiguration.class);
+ super(OrientDatabaseConfiguration.class);
this.cacheService = cacheService;
this.threadService = threadService;
this.daoResolver = daoResolver;
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/OrientDatabaseConfiguration.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/OrientDatabaseConfiguration.java
new file mode 100644
index 000000000..945409809
--- /dev/null
+++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/orientdb/OrientDatabaseConfiguration.java
@@ -0,0 +1,72 @@
+/*
+ * This file is part of l2jserver2 .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.database.orientdb;
+
+import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
+import com.l2jserver.service.database.DatabaseConfiguration;
+
+/**
+ * Configuration interface for {@link AbstractOrientDatabaseService}.
+ *
+ * @author Rogiel
+ */
+public interface OrientDatabaseConfiguration extends DatabaseConfiguration {
+ /**
+ * @return the orientdb url
+ */
+ @ConfigurationPropertyGetter(defaultValue = "local:data/database")
+ @ConfigurationXPath("connection/@url")
+ String getUrl();
+
+ /**
+ * @param url
+ * the new orientdb url
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/@url")
+ void setUrl(String url);
+
+ /**
+ * @return the orientdb database username
+ */
+ @ConfigurationPropertyGetter(defaultValue = "admin")
+ @ConfigurationXPath("connection/authentication/@username")
+ String getUsername();
+
+ /**
+ * @param username
+ * the orientdb database username
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/authentication/@username")
+ void setUsername(String username);
+
+ /**
+ * @return the orientdb database password
+ */
+ @ConfigurationPropertyGetter(defaultValue = "admin")
+ @ConfigurationXPath("connection/authentication/@password")
+ String getPassword();
+
+ /**
+ * @param password
+ * the jdbc database password
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/authentication/@password")
+ void setPassword(String password);
+}
\ No newline at end of file
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java
index 171af5ebc..00460ff9a 100644
--- a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java
+++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/AbstractSQLDatabaseService.java
@@ -43,13 +43,11 @@ import com.l2jserver.model.Model;
import com.l2jserver.model.Model.ObjectDesire;
import com.l2jserver.model.id.ID;
import com.l2jserver.model.id.object.allocator.IDAllocator;
-import com.l2jserver.service.AbstractService;
+import com.l2jserver.service.AbstractConfigurableService;
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.threading.AbstractTask;
import com.l2jserver.service.core.threading.AsyncFuture;
import com.l2jserver.service.core.threading.ScheduledAsyncFuture;
@@ -101,12 +99,9 @@ import com.mysema.query.types.Path;
*
* @author Rogiel
*/
-public abstract class AbstractSQLDatabaseService extends AbstractService
- implements DatabaseService {
- /**
- * The configuration object
- */
- private final JDBCDatabaseConfiguration config;
+public abstract class AbstractSQLDatabaseService extends
+ AbstractConfigurableService implements
+ DatabaseService {
/**
* The logger
*/
@@ -173,120 +168,6 @@ public abstract class AbstractSQLDatabaseService extends AbstractService
private final Type>[] sqlTypes;
/**
- * Configuration interface for {@link AbstractSQLDatabaseService}.
- *
- * @author Rogiel
- */
- public interface JDBCDatabaseConfiguration extends DatabaseConfiguration {
- /**
- * @return the jdbc url
- */
- @ConfigurationPropertyGetter(defaultValue = "jdbc:mysql://localhost/l2jserver2")
- @ConfigurationXPath("/configuration/services/database/jdbc/url")
- String getJdbcUrl();
-
- /**
- * @param jdbcUrl
- * the new jdbc url
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/jdbc/url")
- void setJdbcUrl(String jdbcUrl);
-
- /**
- * @return the database engine class
- */
- @ConfigurationPropertyGetter(defaultValue = "com.l2jserver.service.database.sql.MySQLDatabaseEngine")
- @ConfigurationXPath("/configuration/services/database/jdbc/engine")
- Class extends DatabaseEngine> getDatabaseEngineClass();
-
- /**
- * @param driver
- * the new database engine class
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/jdbc/engine")
- void setDatabaseEngineClass(Class extends DatabaseEngine> driver);
-
- /**
- * @return the jdbc database username
- */
- @ConfigurationPropertyGetter(defaultValue = "l2j")
- @ConfigurationXPath("/configuration/services/database/jdbc/username")
- String getUsername();
-
- /**
- * @param username
- * the jdbc database username
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/jdbc/username")
- void setUsername(String username);
-
- /**
- * @return the jdbc database password
- */
- @ConfigurationPropertyGetter(defaultValue = "changeme")
- @ConfigurationXPath("/configuration/services/database/jdbc/password")
- String getPassword();
-
- /**
- * @param password
- * the jdbc database password
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/jdbc/password")
- void setPassword(String password);
-
- /**
- * @return the maximum number of active connections
- */
- @ConfigurationPropertyGetter(defaultValue = "20")
- @ConfigurationXPath("/configuration/services/database/connections/active-maximum")
- int getMaxActiveConnections();
-
- /**
- * @param password
- * the maximum number of active connections
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/connections/active-maximum")
- void setMaxActiveConnections(int password);
-
- /**
- * @return the maximum number of idle connections
- */
- @ConfigurationPropertyGetter(defaultValue = "20")
- @ConfigurationXPath("/configuration/services/database/connections/idle-maximum")
- int getMaxIdleConnections();
-
- /**
- * @param password
- * the maximum number of idle connections
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/connections/idle-maximum")
- void setMaxIdleConnections(int password);
-
- /**
- * @return the minimum number of idle connections
- */
- @ConfigurationPropertyGetter(defaultValue = "5")
- @ConfigurationXPath("/configuration/services/database/connections/idle-minimum")
- int getMinIdleConnections();
-
- /**
- * @param password
- * the minimum number of idle connections
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/services/database/connections/idle-minimum")
- void setMinIdleConnections(int password);
- }
-
- /**
- * @param configService
- * the configuration service
* @param cacheService
* the cache service
* @param threadService
@@ -299,10 +180,10 @@ public abstract class AbstractSQLDatabaseService extends AbstractService
* the SQL mapping types
*/
@Inject
- public AbstractSQLDatabaseService(ConfigurationService configService,
- CacheService cacheService, ThreadService threadService,
- VFSService vfsService, DAOResolver daoResolver, Type>... types) {
- config = configService.get(JDBCDatabaseConfiguration.class);
+ public AbstractSQLDatabaseService(CacheService cacheService,
+ ThreadService threadService, VFSService vfsService,
+ DAOResolver daoResolver, Type>... types) {
+ super(JDBCDatabaseConfiguration.class);
this.cacheService = cacheService;
this.threadService = threadService;
this.vfsService = vfsService;
@@ -409,6 +290,7 @@ public abstract class AbstractSQLDatabaseService extends AbstractService
}
log.info("Importing {} to {}", path, entity);
try {
+ conn.setAutoCommit(false);
CSVUtils.parseCSV(path, new CSVMapProcessor() {
@Override
public Long process(final Map map) {
@@ -433,8 +315,15 @@ public abstract class AbstractSQLDatabaseService extends AbstractService
return insert.execute();
}
});
+ conn.commit();
+ } catch (SQLException e) {
+ try {
+ conn.rollback();
+ } catch (SQLException e1) {
+ }
} finally {
try {
+ conn.setAutoCommit(true);
conn.close();
} catch (SQLException e) {
}
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/JDBCDatabaseConfiguration.java b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/JDBCDatabaseConfiguration.java
new file mode 100644
index 000000000..9d3c7d952
--- /dev/null
+++ b/l2jserver2-common/src/main/java/com/l2jserver/service/database/sql/JDBCDatabaseConfiguration.java
@@ -0,0 +1,132 @@
+/*
+ * This file is part of l2jserver2 .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.database.sql;
+
+import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
+import com.l2jserver.service.database.DatabaseConfiguration;
+
+/**
+ * Configuration interface for {@link AbstractSQLDatabaseService}.
+ *
+ * @author Rogiel
+ */
+public interface JDBCDatabaseConfiguration extends DatabaseConfiguration {
+ /**
+ * @return the jdbc url
+ */
+ @ConfigurationPropertyGetter(defaultValue = "jdbc:mysql://localhost/l2jserver2")
+ @ConfigurationXPath("connection/@url")
+ String getJdbcUrl();
+
+ /**
+ * @param jdbcUrl
+ * the new jdbc url
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/@url")
+ void setJdbcUrl(String jdbcUrl);
+
+ /**
+ * @return the database engine class
+ */
+ @ConfigurationPropertyGetter(defaultValue = "com.l2jserver.service.database.sql.MySQLDatabaseEngine")
+ @ConfigurationXPath("connection/engine/@class")
+ Class extends DatabaseEngine> getDatabaseEngineClass();
+
+ /**
+ * @param driver
+ * the new database engine class
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/engine/@class")
+ void setDatabaseEngineClass(Class extends DatabaseEngine> driver);
+
+ /**
+ * @return the jdbc database username
+ */
+ @ConfigurationPropertyGetter(defaultValue = "l2j")
+ @ConfigurationXPath("connection/authentication/@username")
+ String getUsername();
+
+ /**
+ * @param username
+ * the jdbc database username
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/authentication/@username")
+ void setUsername(String username);
+
+ /**
+ * @return the jdbc database password
+ */
+ @ConfigurationPropertyGetter(defaultValue = "changeme")
+ @ConfigurationXPath("connection/authentication/@password")
+ String getPassword();
+
+ /**
+ * @param password
+ * the jdbc database password
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/authentication/@password")
+ void setPassword(String password);
+
+ /**
+ * @return the maximum number of active connections
+ */
+ @ConfigurationPropertyGetter(defaultValue = "20")
+ @ConfigurationXPath("connection/pool/@max-active")
+ int getMaxActiveConnections();
+
+ /**
+ * @param maxActive
+ * the maximum number of active connections
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/pool/@max-active")
+ void setMaxActiveConnections(int maxActive);
+
+ /**
+ * @return the maximum number of idle connections
+ */
+ @ConfigurationPropertyGetter(defaultValue = "20")
+ @ConfigurationXPath("connection/pool/@max-idle")
+ int getMaxIdleConnections();
+
+ /**
+ * @param maxIdle
+ * the maximum number of idle connections
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/pool/@max-idle")
+ void setMaxIdleConnections(int maxIdle);
+
+ /**
+ * @return the minimum number of idle connections
+ */
+ @ConfigurationPropertyGetter(defaultValue = "5")
+ @ConfigurationXPath("connection/pool/@min-idle")
+ int getMinIdleConnections();
+
+ /**
+ * @param minIdle
+ * the minimum number of idle connections
+ */
+ @ConfigurationPropertySetter
+ @ConfigurationXPath("connection/pool/@min-idle")
+ void setMinIdleConnections(int minIdle);
+}
\ No newline at end of file
diff --git a/l2jserver2-common/src/main/java/com/l2jserver/util/ClassUtils.java b/l2jserver2-common/src/main/java/com/l2jserver/util/ClassUtils.java
index 45d0623ae..f1e495cc4 100644
--- a/l2jserver2-common/src/main/java/com/l2jserver/util/ClassUtils.java
+++ b/l2jserver2-common/src/main/java/com/l2jserver/util/ClassUtils.java
@@ -16,6 +16,7 @@
*/
package com.l2jserver.util;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
/**
@@ -61,6 +62,39 @@ public class ClassUtils {
return false;
}
+ /**
+ * Recursively searches for an annotation Search order
+ *
+ *
+ * cls class
+ * cls implementing interfaces
+ * cls super class
+ *
+ * If after all those steps, no annotation is found, null is
+ * returned.
+ *
+ * @param annotationClass
+ * the annotation class
+ * @param cls
+ * the class to start searching
+ * @return the annotation, if found.
+ */
+ public static T getAnnotation(
+ Class annotationClass, Class> cls) {
+ T annotation = cls.getAnnotation(annotationClass);
+ if (annotation == null) {
+ for (final Class> interfaceCls : cls.getInterfaces()) {
+ annotation = getAnnotation(annotationClass, interfaceCls);
+ if (annotation != null)
+ break;
+ }
+ }
+ if (annotation == null && cls.getSuperclass() != null
+ && cls.getSuperclass() != Object.class)
+ annotation = getAnnotation(annotationClass, cls.getSuperclass());
+ return annotation;
+ }
+
/**
* Checks if class in member of the package
*
diff --git a/l2jserver2-common/src/test/java/com/l2jserver/service/configuration/XMLConfigurationServiceTest.java b/l2jserver2-common/src/test/java/com/l2jserver/service/configuration/XMLConfigurationServiceTest.java
deleted file mode 100644
index 840659984..000000000
--- a/l2jserver2-common/src/test/java/com/l2jserver/service/configuration/XMLConfigurationServiceTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * 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 .
- */
-package com.l2jserver.service.configuration;
-
-import java.io.File;
-
-import junit.framework.Assert;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.l2jserver.service.ServiceStartException;
-import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
-
-/**
- * Tests for {@link XMLConfigurationService}
- *
- * @author Rogiel
- */
-public class XMLConfigurationServiceTest {
- /**
- * The {@link TestConfig} proxy
- */
- private TestConfig config;
-
- /**
- * Preparation for tests
- *
- * @throws ServiceStartException
- */
- @Before
- public void tearUp() throws ServiceStartException {
- final XMLConfigurationService service = new XMLConfigurationService(
- new File("src/test/resources/test-config.xml"));
- service.start();
- config = service.get(TestConfig.class);
- }
-
- /**
- * Test config string
- *
- * @throws ServiceStartException
- */
- @Test
- public void testString() throws ServiceStartException {
- Assert.assertEquals("test", config.getTestString());
- }
-
- /**
- * Test default value
- *
- * @throws ServiceStartException
- */
- @Test
- public void testDefaultValue() throws ServiceStartException {
- Assert.assertEquals("default", config.getDefaultTestString());
- }
-
- /**
- * Test integer
- *
- * @throws ServiceStartException
- */
- @Test
- public void testInteger() throws ServiceStartException {
- Assert.assertEquals(256, config.getTestInteger());
- }
-
- /**
- * Test setter
- *
- * @throws ServiceStartException
- */
- @Test
- public void testSetter() throws ServiceStartException {
- config.setTestString("new-value");
- Assert.assertEquals("new-value", config.getTestString());
- }
-
- /**
- * Test null setter
- *
- * @throws ServiceStartException
- */
- @Test
- public void testNullSetter() throws ServiceStartException {
- config.setTestString(null);
- Assert.assertEquals("test-default", config.getTestString());
- }
-
- /**
- * The TestConfig interface
- *
- * @author Rogiel
- */
- public interface TestConfig extends Configuration {
- /**
- * @return an configuration string
- */
- @ConfigurationPropertyGetter(defaultValue = "test-default")
- @ConfigurationXPath("/configuration/test/testvalue")
- String getTestString();
-
- /**
- * @param value
- * any string
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/test/testvalue")
- void setTestString(String value);
-
- /**
- * @return an configuration string
- */
- @ConfigurationPropertyGetter(defaultValue = "default")
- @ConfigurationXPath("/configuration/test/nonexistentkey")
- String getDefaultTestString();
-
- /**
- * @return an configuration integer
- */
- @ConfigurationPropertyGetter(defaultValue = "0")
- @ConfigurationXPath("/configuration/test/integer")
- int getTestInteger();
-
- /**
- * @param n
- * any integer
- */
- @ConfigurationPropertySetter
- @ConfigurationXPath("/configuration/test/integer")
- void setTestInteger(Integer n);
- }
-}
diff --git a/l2jserver2-gameserver/.gitignore b/l2jserver2-gameserver/.gitignore
index b2ea08db6..4c6512dac 100644
--- a/l2jserver2-gameserver/.gitignore
+++ b/l2jserver2-gameserver/.gitignore
@@ -1,2 +1,3 @@
/log
/derby.log
+/services.xml
diff --git a/l2jserver2-gameserver/config/.gitignore b/l2jserver2-gameserver/config/.gitignore
deleted file mode 100644
index 81e4b0b61..000000000
--- a/l2jserver2-gameserver/config/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/config.xml
diff --git a/l2jserver2-gameserver/config/config-dev-sample.xml b/l2jserver2-gameserver/config/config-dev-sample.xml
deleted file mode 100644
index 67b2188c2..000000000
--- a/l2jserver2-gameserver/config/config-dev-sample.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
- 1.0
-
- 1.0
-
-
-
-
-
-
-
-
- true
-
-
-
-
- local:data/database
-
- admin
-
- admin
-
-
-
-
-
- jdbc:mysql://localhost/l2jserver2
-
-
- com.l2jserver.service.database.sql.MySQLDatabaseEngine
-
-
-
- l2j
-
-
- changeme
-
-
-
-
- 20
-
- 20
-
- 5
-
-
-
-
-
-
- 0.0.0.0:7777
-
-
-
-
-
-
-
-
- data/
-
-
-
-
-
- template/
-
-
-
-
\ No newline at end of file
diff --git a/l2jserver2-gameserver/config/config.xml b/l2jserver2-gameserver/config/config.xml
deleted file mode 100644
index 67b2188c2..000000000
--- a/l2jserver2-gameserver/config/config.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
- 1.0
-
- 1.0
-
-
-
-
-
-
-
-
- true
-
-
-
-
- local:data/database
-
- admin
-
- admin
-
-
-
-
-
- jdbc:mysql://localhost/l2jserver2
-
-
- com.l2jserver.service.database.sql.MySQLDatabaseEngine
-
-
-
- l2j
-
-
- changeme
-
-
-
-
- 20
-
- 20
-
- 5
-
-
-
-
-
-
- 0.0.0.0:7777
-
-
-
-
-
-
-
-
- data/
-
-
-
-
-
- template/
-
-
-
-
\ No newline at end of file
diff --git a/l2jserver2-gameserver/distribution/global/LICENSE b/l2jserver2-gameserver/distribution/LICENSE
similarity index 100%
rename from l2jserver2-gameserver/distribution/global/LICENSE
rename to l2jserver2-gameserver/distribution/LICENSE
diff --git a/l2jserver2-gameserver/distribution/global/README b/l2jserver2-gameserver/distribution/README
similarity index 100%
rename from l2jserver2-gameserver/distribution/global/README
rename to l2jserver2-gameserver/distribution/README
diff --git a/l2jserver2-gameserver/distribution/global/config/config.xml b/l2jserver2-gameserver/distribution/global/config/config.xml
deleted file mode 100644
index 04b2721d8..000000000
--- a/l2jserver2-gameserver/distribution/global/config/config.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
- 1.0
-
- 1.0
-
-
-
-
-
-
-
-
- true
-
-
-
-
- local:data/database
-
- admin
-
- admin
-
-
-
-
-
- jdbc:mysql://localhost/l2jserver2
-
-
- com.l2jserver.service.database.sql.MySQLDatabaseEngine
-
-
-
- l2j
-
-
- changeme
-
-
-
-
- 20
-
- 20
-
- 5
-
-
-
-
-
-
- 0.0.0.0:7777
-
-
-
-
-
-
-
-
- data.zip
-
-
-
-
-
- template/
-
-
-
-
\ No newline at end of file
diff --git a/l2jserver2-gameserver/distribution/services.xml b/l2jserver2-gameserver/distribution/services.xml
new file mode 100644
index 000000000..db8f71a41
--- /dev/null
+++ b/l2jserver2-gameserver/distribution/services.xml
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/l2jserver2-gameserver/distribution/global/start.bat b/l2jserver2-gameserver/distribution/start.bat
similarity index 100%
rename from l2jserver2-gameserver/distribution/global/start.bat
rename to l2jserver2-gameserver/distribution/start.bat
diff --git a/l2jserver2-gameserver/distribution/global/start.sh b/l2jserver2-gameserver/distribution/start.sh
similarity index 100%
rename from l2jserver2-gameserver/distribution/global/start.sh
rename to l2jserver2-gameserver/distribution/start.sh
diff --git a/l2jserver2-gameserver/services-sample.xml b/l2jserver2-gameserver/services-sample.xml
new file mode 100644
index 000000000..1da3822fd
--- /dev/null
+++ b/l2jserver2-gameserver/services-sample.xml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/l2jserver2-gameserver/src/main/assembly/distribution-derby-bin.xml b/l2jserver2-gameserver/src/main/assembly/distribution-derby-bin.xml
index a8f8d6a99..4cab32e7e 100644
--- a/l2jserver2-gameserver/src/main/assembly/distribution-derby-bin.xml
+++ b/l2jserver2-gameserver/src/main/assembly/distribution-derby-bin.xml
@@ -9,7 +9,7 @@
- ${project.basedir}/distribution/global
+ ${project.basedir}/distribution
/
diff --git a/l2jserver2-gameserver/src/main/assembly/distribution-h2-bin.xml b/l2jserver2-gameserver/src/main/assembly/distribution-h2-bin.xml
index 0eb55b64f..a288a7f21 100644
--- a/l2jserver2-gameserver/src/main/assembly/distribution-h2-bin.xml
+++ b/l2jserver2-gameserver/src/main/assembly/distribution-h2-bin.xml
@@ -9,7 +9,7 @@
- ${project.basedir}/distribution/global
+ ${project.basedir}/distribution
/
diff --git a/l2jserver2-gameserver/src/main/assembly/distribution-mysql5-bin.xml b/l2jserver2-gameserver/src/main/assembly/distribution-mysql5-bin.xml
index 6cd363a96..eb845facf 100644
--- a/l2jserver2-gameserver/src/main/assembly/distribution-mysql5-bin.xml
+++ b/l2jserver2-gameserver/src/main/assembly/distribution-mysql5-bin.xml
@@ -9,7 +9,7 @@
- ${project.basedir}/distribution/global
+ ${project.basedir}/distribution
/
diff --git a/l2jserver2-gameserver/src/main/assembly/distribution-orientdb-bin.xml b/l2jserver2-gameserver/src/main/assembly/distribution-orientdb-bin.xml
index 264ab5263..cfec84f04 100644
--- a/l2jserver2-gameserver/src/main/assembly/distribution-orientdb-bin.xml
+++ b/l2jserver2-gameserver/src/main/assembly/distribution-orientdb-bin.xml
@@ -9,7 +9,7 @@
- ${project.basedir}/distribution/global
+ ${project.basedir}/distribution
/
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java
index 74bffb275..98b212862 100644
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/L2JGameServerMain.java
@@ -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() {
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/ServiceModule.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/ServiceModule.java
deleted file mode 100644
index 7107d1428..000000000
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/ServiceModule.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * This file is part of l2jserver2 .
- *
- * 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 .
- */
-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 Rogiel
- */
-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);
- }
-}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerJDBCDatabaseService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerJDBCDatabaseService.java
index 27427c96f..a08308b84 100644
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerJDBCDatabaseService.java
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerJDBCDatabaseService.java
@@ -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);
}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java
index 32f14222a..244ad7038 100644
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/database/GameServerOrientDatabaseService.java
@@ -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);
}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/template/XMLTemplateService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/template/XMLTemplateService.java
index d6f8ce41e..192925e74 100644
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/template/XMLTemplateService.java
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/template/XMLTemplateService.java
@@ -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 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 templates;
- /**
- * XML {@link TemplateService} configuration interface
- *
- * @author Rogiel
- */
- 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;
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/template/XMLTemplateServiceConfiguration.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/template/XMLTemplateServiceConfiguration.java
new file mode 100644
index 000000000..0a9c82d11
--- /dev/null
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/game/template/XMLTemplateServiceConfiguration.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of l2jserver2 .
+ *
+ * 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 .
+ */
+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 Rogiel
+ */
+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);
+}
\ No newline at end of file
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NettyNetworkService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NettyNetworkService.java
index 140443f55..d0198e2de 100644
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NettyNetworkService.java
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NettyNetworkService.java
@@ -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 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 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());
}
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NetworkService.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NetworkService.java
index d2db0ecc2..a50f4f113 100644
--- a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NetworkService.java
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NetworkService.java
@@ -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 Rogiel
*/
public interface NetworkService extends Service {
- /**
- * The network {@link Configuration}
- *
- * @author Rogiel
- */
- 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
*
diff --git a/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NetworkServiceConfiguration.java b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NetworkServiceConfiguration.java
new file mode 100644
index 000000000..b7ebbc715
--- /dev/null
+++ b/l2jserver2-gameserver/src/main/java/com/l2jserver/service/network/NetworkServiceConfiguration.java
@@ -0,0 +1,49 @@
+/*
+ * This file is part of l2jserver2 .
+ *
+ * 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 .
+ */
+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 Rogiel
+ */
+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);
+}
\ No newline at end of file
diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java
index a7cfcbd30..e3e658a4f 100644
--- a/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java
+++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/db/dao/mysql5/MySQL5CharacterDAOTest.java
@@ -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);
diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java
index 061dd6433..2bddba19a 100644
--- a/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java
+++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/model/id/provider/CharacterIDProviderTest.java
@@ -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
diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java
index 95967a61c..dc75934c9 100644
--- a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java
+++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldEventDispatcherImplTest.java
@@ -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);
diff --git a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java
index d7251318c..6a87bf876 100644
--- a/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java
+++ b/l2jserver2-gameserver/src/test/java/com/l2jserver/service/world/WorldServiceImplTest.java
@@ -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 Rogiel
*/
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);
diff --git a/l2jserver2-loginserver/src/main/java/com/l2jserver/service/database/LoginServerSQLDatabaseService.java b/l2jserver2-loginserver/src/main/java/com/l2jserver/service/database/LoginServerSQLDatabaseService.java
index c33862427..18703078f 100644
--- a/l2jserver2-loginserver/src/main/java/com/l2jserver/service/database/LoginServerSQLDatabaseService.java
+++ b/l2jserver2-loginserver/src/main/java/com/l2jserver/service/database/LoginServerSQLDatabaseService.java
@@ -53,8 +53,6 @@ import com.l2jserver.service.database.sql.AbstractSQLDatabaseService;
public class LoginServerSQLDatabaseService extends AbstractSQLDatabaseService
implements DatabaseService {
/**
- * @param configService
- * the config service
* @param cacheService
* the cache service
* @param threadService
@@ -64,11 +62,10 @@ public class LoginServerSQLDatabaseService extends AbstractSQLDatabaseService
* @param daoResolver
* the {@link DataAccessObject DAO} resolver
*/
- public LoginServerSQLDatabaseService(ConfigurationService configService,
- CacheService cacheService, ThreadService threadService,
- VFSService vfsService, DAOResolver daoResolver) {
- super(configService, cacheService, threadService, vfsService,
- daoResolver);
+ public LoginServerSQLDatabaseService(CacheService cacheService,
+ ThreadService threadService, VFSService vfsService,
+ DAOResolver daoResolver) {
+ super(cacheService, threadService, vfsService, daoResolver);
}
@Override
diff --git a/l2jserver2-loginserver/src/main/java/com/l2jserver/service/gameserver/GameServerNetworkService.java b/l2jserver2-loginserver/src/main/java/com/l2jserver/service/gameserver/GameServerNetworkService.java
index 1c0c044a8..e5014eae4 100644
--- a/l2jserver2-loginserver/src/main/java/com/l2jserver/service/gameserver/GameServerNetworkService.java
+++ b/l2jserver2-loginserver/src/main/java/com/l2jserver/service/gameserver/GameServerNetworkService.java
@@ -16,12 +16,8 @@
*/
package com.l2jserver.service.gameserver;
-import java.net.InetSocketAddress;
import com.l2jserver.service.Service;
-import com.l2jserver.service.ServiceConfiguration;
-import com.l2jserver.service.configuration.Configuration;
-import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
/**
* TODO
@@ -29,29 +25,4 @@ import com.l2jserver.service.configuration.XMLConfigurationService.Configuration
* @author Rogiel
*/
public interface GameServerNetworkService extends Service {
- /**
- * The network {@link Configuration}
- *
- * @author Rogiel
- */
- public interface NetworkConfiguration extends ServiceConfiguration {
- /**
- * Get the server listen address
- *
- * @return the listen address
- */
- @ConfigurationPropertyGetter(defaultValue = "0.0.0.0:2104")
- @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);
- }
}
diff --git a/l2jserver2-loginserver/src/main/java/com/l2jserver/service/gameserver/NetworkConfiguration.java b/l2jserver2-loginserver/src/main/java/com/l2jserver/service/gameserver/NetworkConfiguration.java
new file mode 100644
index 000000000..17df945d0
--- /dev/null
+++ b/l2jserver2-loginserver/src/main/java/com/l2jserver/service/gameserver/NetworkConfiguration.java
@@ -0,0 +1,51 @@
+/*
+ * This file is part of l2jserver2 .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.gameserver;
+
+import java.net.InetSocketAddress;
+
+import com.l2jserver.service.ServiceConfiguration;
+import com.l2jserver.service.configuration.Configuration;
+import com.l2jserver.service.configuration.Configuration.ConfigurationPropertyGetter;
+import com.l2jserver.service.configuration.Configuration.ConfigurationPropertySetter;
+import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
+
+/**
+ * The network {@link Configuration}
+ *
+ * @author Rogiel
+ */
+public interface NetworkConfiguration extends ServiceConfiguration {
+ /**
+ * Get the server listen address
+ *
+ * @return the listen address
+ */
+ @ConfigurationPropertyGetter(defaultValue = "0.0.0.0:2104")
+ @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);
+}
\ No newline at end of file