mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
Change-Id: I7385cf78327165548c25be9184190f5b80eeba9c
This commit is contained in:
20
pom.xml
20
pom.xml
@@ -9,23 +9,9 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.netty</groupId>
|
<groupId>com.l2jserver</groupId>
|
||||||
<artifactId>netty</artifactId>
|
<artifactId>l2jserver2-core</artifactId>
|
||||||
<version>3.2.4.Final</version>
|
<version>2.0.0-DEVEL</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.8.2</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.inject</groupId>
|
|
||||||
<artifactId>guice</artifactId>
|
|
||||||
<version>3.0</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -1,23 +1,10 @@
|
|||||||
package com.l2jserver.service;
|
package com.l2jserver.service;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Scopes;
|
|
||||||
import com.l2jserver.service.configuration.ConfigurationService;
|
|
||||||
import com.l2jserver.service.configuration.ProxyConfigurationService;
|
|
||||||
import com.l2jserver.service.database.DB4ODatabaseService;
|
|
||||||
import com.l2jserver.service.database.DatabaseService;
|
|
||||||
import com.l2jserver.service.network.NettyNetworkService;
|
|
||||||
import com.l2jserver.service.network.NetworkService;
|
|
||||||
|
|
||||||
public class ServiceModule extends AbstractModule {
|
public class ServiceModule extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(ConfigurationService.class).to(ProxyConfigurationService.class)
|
install(new BasicServiceModule());
|
||||||
.in(Scopes.SINGLETON);
|
|
||||||
bind(DatabaseService.class).to(DB4ODatabaseService.class).in(
|
|
||||||
Scopes.SINGLETON);
|
|
||||||
|
|
||||||
bind(NetworkService.class).to(NettyNetworkService.class).in(
|
|
||||||
Scopes.SINGLETON);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.l2jserver.service.configuration;
|
|
||||||
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
|
||||||
|
|
||||||
@ConfigurationName("l2j")
|
|
||||||
public interface Configuration {
|
|
||||||
|
|
||||||
public @interface ConfigurationName {
|
|
||||||
String value();
|
|
||||||
}
|
|
||||||
|
|
||||||
public @interface ConfigurationPrefix {
|
|
||||||
String value();
|
|
||||||
}
|
|
||||||
|
|
||||||
public @interface ConfigurationPropertyGetter {
|
|
||||||
String name();
|
|
||||||
String defaultValue() default "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public @interface ConfigurationPropertySetter {
|
|
||||||
String name();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.l2jserver.service.configuration;
|
|
||||||
|
|
||||||
public interface ConfigurationService {
|
|
||||||
<C extends Configuration> C get(Class<C> config);
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.l2jserver.service.configuration;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class ProxyConfigurationService implements ConfigurationService {
|
|
||||||
private Properties properties;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <C extends Configuration> C get(Class<C> config) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
|
|
||||||
public abstract class AbstractDAO implements DataAccessObject {
|
|
||||||
protected final DatabaseService database;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected AbstractDAO(DatabaseService database) {
|
|
||||||
this.database = database;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseService getDatabase() {
|
|
||||||
return database;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
public class DB4ODatabaseService implements DatabaseService {
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The DAO interface
|
|
||||||
*
|
|
||||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
|
||||||
*/
|
|
||||||
public interface DataAccessObject {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
import com.l2jserver.service.configuration.Configuration;
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationName;
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationPrefix;
|
|
||||||
|
|
||||||
@ConfigurationName("database")
|
|
||||||
@ConfigurationPrefix("database")
|
|
||||||
public interface DatabaseConfiguration extends Configuration {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
import com.l2jserver.service.Service;
|
|
||||||
|
|
||||||
public interface DatabaseService extends Service {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import com.l2jserver.service.configuration.ConfigurationService;
|
|
||||||
|
|
||||||
public class MySQL5DatabaseService implements DatabaseService {
|
|
||||||
private final MySQLDatabaseConfiguration config;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public MySQL5DatabaseService(ConfigurationService configService) {
|
|
||||||
config = configService.get(MySQLDatabaseConfiguration.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.l2jserver.service.database;
|
|
||||||
|
|
||||||
import com.l2jserver.service.configuration.Configuration.ConfigurationPrefix;
|
|
||||||
|
|
||||||
@ConfigurationPrefix("mysql")
|
|
||||||
public interface MySQLDatabaseConfiguration extends DatabaseConfiguration {
|
|
||||||
/**
|
|
||||||
* @return the jdbc url
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.url", defaultValue = "jdbc:mysql://localhost/l2jserver-gs")
|
|
||||||
String getJdbcUrl();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param jdbcUrl
|
|
||||||
* the new jdbc url
|
|
||||||
*/
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.url")
|
|
||||||
void setJdbcUrl(String jdbcUrl);
|
|
||||||
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.username", defaultValue = "root")
|
|
||||||
String getUsername();
|
|
||||||
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.username")
|
|
||||||
void setUsername(String username);
|
|
||||||
|
|
||||||
@ConfigurationPropertyGetter(name = "jdbc.password")
|
|
||||||
String getPassword();
|
|
||||||
|
|
||||||
@ConfigurationPropertySetter(name = "jdbc.password")
|
|
||||||
void setPassword(String password);
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.l2jserver.service.logging;
|
|
||||||
|
|
||||||
public class JdkLogger implements Logger {
|
|
||||||
private final java.util.logging.Logger logger;
|
|
||||||
|
|
||||||
public JdkLogger(java.util.logging.Logger logger) {
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void info(String message) {
|
|
||||||
logger.info(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void info(String message, Exception e) {
|
|
||||||
logger.info(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package com.l2jserver.service.logging;
|
|
||||||
|
|
||||||
import java.util.logging.LogManager;
|
|
||||||
|
|
||||||
import com.l2jserver.service.ServiceStartException;
|
|
||||||
import com.l2jserver.service.ServiceStopException;
|
|
||||||
|
|
||||||
public class JdkLoggingService implements LoggingService {
|
|
||||||
@Override
|
|
||||||
public void start() throws ServiceStartException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Logger getLogger(Class<?> clazz) {
|
|
||||||
return new JdkLogger(LogManager.getLogManager().getLogger(
|
|
||||||
clazz.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() throws ServiceStopException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.l2jserver.service.logging;
|
|
||||||
|
|
||||||
public interface Logger {
|
|
||||||
void info(String message);
|
|
||||||
|
|
||||||
void info(String message, Exception e);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package com.l2jserver.service.logging;
|
|
||||||
|
|
||||||
import com.l2jserver.service.Service;
|
|
||||||
|
|
||||||
public interface LoggingService extends Service {
|
|
||||||
Logger getLogger(Class<?> clazz);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user