1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-06 07:32:46 +00:00

Modularizes the Maven project

This commit modularizes the maven project into several modules:
 - l2jserver2-common: common sources for both login and gameserver
 - l2jserver2-gameserver: the game server
 - l2jserver2-loginserver: the login server
 - l2jserver2-tools: refactored src/tools/java soure folder
This commit is contained in:
2011-10-05 17:32:04 -03:00
parent c4052ccb3b
commit 22c136ab17
18930 changed files with 4292 additions and 231 deletions

View File

@@ -1,13 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="src" path="src/tool/java"/>
<classpathentry kind="src" path="data/plugin"/>
<classpathentry kind="src" path="data/script/ai"/>
<classpathentry kind="src" path="data/script/quest"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>

16
.gitignore vendored
View File

@@ -1,2 +1,14 @@
/target
/generated
# Eclipse project files and folders
.project
.metadata
.classpath
.settings/
# Locally stored "Eclipse launch configurations"
*.launch
# Maven target directory
target/
# Find bugs configuration file
/.fbprefs

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>l2jserver2-gameserver</name>
<name>l2jserver2</name>
<comment></comment>
<projects>
</projects>

147
l2jserver2-common/pom.xml Normal file
View File

@@ -0,0 +1,147 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>l2jserver2</artifactId>
<groupId>com.l2jserver</groupId>
<version>2.0.0</version>
<relativePath>..</relativePath>
</parent>
<artifactId>l2jserver2-common</artifactId>
<dependencies>
<!-- junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<!-- netty -->
<dependency>
<groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId>
<version>3.2.4.Final</version>
<scope>runtime</scope>
</dependency>
<!-- google guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>3.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId>
<version>3.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<!-- database -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.16</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.155</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<!-- cache -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.4.2</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<!-- html parser/generator -->
<dependency>
<groupId>org.htmlparser</groupId>
<artifactId>htmlparser</artifactId>
<version>2.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<!-- utils -->
<dependency>
<groupId>javolution</groupId>
<artifactId>javolution</artifactId>
<version>5.5.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>10.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.6</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,47 @@
/*
* 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.model.id;
import com.l2jserver.model.Model;
/**
* This is an abstract ID for most model objects.
*
* @param <T>
* the raw id type
* @param <O>
* the model this {@link ID} provides
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class AbstractModelID<T, O extends Model<? extends ID<T>>>
extends ID<T> {
/**
* @param id
* the id
*/
protected AbstractModelID(T id) {
super(id);
}
/**
* @return the {@link Model} object associated with this
* {@link AbstractModelID}. <tt>null</tt> if {@link Model} does not
* exists.
*/
public abstract O getObject();
}

View File

@@ -36,25 +36,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.l2jserver.model.Model;
import com.l2jserver.model.Model.ObjectDesire;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.dao.ClanDAO;
import com.l2jserver.model.dao.ItemDAO;
import com.l2jserver.model.dao.NPCDAO;
import com.l2jserver.model.dao.PetDAO;
import com.l2jserver.model.id.ID;
import com.l2jserver.model.id.object.allocator.IDAllocator;
import com.l2jserver.model.world.Clan;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.NPC;
import com.l2jserver.model.world.Pet;
import com.l2jserver.service.AbstractService;
import com.l2jserver.service.AbstractService.Depends;
import com.l2jserver.service.ServiceStartException;
import com.l2jserver.service.ServiceStopException;
import com.l2jserver.service.cache.Cache;
@@ -62,12 +49,9 @@ import com.l2jserver.service.cache.CacheService;
import com.l2jserver.service.configuration.ConfigurationService;
import com.l2jserver.service.configuration.ProxyConfigurationService.ConfigurationPropertiesKey;
import com.l2jserver.service.configuration.XMLConfigurationService.ConfigurationXPath;
import com.l2jserver.service.core.LoggingService;
import com.l2jserver.service.core.threading.ScheduledAsyncFuture;
import com.l2jserver.service.core.threading.ThreadService;
import com.l2jserver.service.game.template.TemplateService;
import com.l2jserver.util.ArrayIterator;
import com.l2jserver.util.ClassUtils;
import com.l2jserver.util.factory.CollectionFactory;
/**
@@ -92,10 +76,8 @@ import com.l2jserver.util.factory.CollectionFactory;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
@Depends({ LoggingService.class, CacheService.class,
ConfigurationService.class, TemplateService.class, ThreadService.class })
public class JDBCDatabaseService extends AbstractService implements
DatabaseService {
public abstract class AbstractJDBCDatabaseService extends AbstractService
implements DatabaseService {
/**
* The configuration object
*/
@@ -104,12 +86,7 @@ public class JDBCDatabaseService extends AbstractService implements
* The logger
*/
private final Logger log = LoggerFactory
.getLogger(JDBCDatabaseService.class);
/**
* The Google Guice {@link Injector}. It is used to get DAO instances.
*/
private final Injector injector;
.getLogger(AbstractJDBCDatabaseService.class);
/**
* The cache service
@@ -149,7 +126,7 @@ public class JDBCDatabaseService extends AbstractService implements
private ScheduledAsyncFuture autoSaveFuture;
/**
* Configuration interface for {@link JDBCDatabaseService}.
* Configuration interface for {@link AbstractJDBCDatabaseService}.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
@@ -277,19 +254,15 @@ public class JDBCDatabaseService extends AbstractService implements
/**
* @param configService
* the configuration service
* @param injector
* the {@link Guice} {@link Injector}
* @param cacheService
* the cache service
* @param threadService
* the thread service
*/
@Inject
public JDBCDatabaseService(ConfigurationService configService,
Injector injector, CacheService cacheService,
ThreadService threadService) {
public AbstractJDBCDatabaseService(ConfigurationService configService,
CacheService cacheService, ThreadService threadService) {
config = configService.get(JDBCDatabaseConfiguration.class);
this.injector = injector;
this.cacheService = cacheService;
this.threadService = threadService;
}
@@ -338,24 +311,6 @@ public class JDBCDatabaseService extends AbstractService implements
});
}
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public <M extends Model<I>, I extends ID<M>> DataAccessObject<M, I> getDAO(
Class<M> model) {
if (ClassUtils.isSubclass(model, L2Character.class)) {
return (DataAccessObject) injector.getInstance(CharacterDAO.class);
} else if (ClassUtils.isSubclass(model, Clan.class)) {
return (DataAccessObject) injector.getInstance(ClanDAO.class);
} else if (ClassUtils.isSubclass(model, Item.class)) {
return (DataAccessObject) injector.getInstance(ItemDAO.class);
} else if (ClassUtils.isSubclass(model, NPC.class)) {
return (DataAccessObject) injector.getInstance(NPCDAO.class);
} else if (ClassUtils.isSubclass(model, Pet.class)) {
return (DataAccessObject) injector.getInstance(PetDAO.class);
}
return null;
}
/**
* Executes an <tt>query</tt> in the database.
*
@@ -806,7 +761,7 @@ public class JDBCDatabaseService extends AbstractService implements
/**
* The database service instance
*/
private final JDBCDatabaseService database;
private final AbstractJDBCDatabaseService database;
/**
* The {@link ID} mapper
@@ -821,7 +776,8 @@ public class JDBCDatabaseService extends AbstractService implements
* @param idMapper
* the {@link ID} {@link Mapper}
*/
public CachedMapper(JDBCDatabaseService database, Mapper<I> idMapper) {
public CachedMapper(AbstractJDBCDatabaseService database,
Mapper<I> idMapper) {
this.database = database;
this.idMapper = idMapper;
}

View File

@@ -21,7 +21,7 @@ import com.l2jserver.model.Model;
import com.l2jserver.model.id.ID;
import com.l2jserver.service.database.AbstractDAO;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.JDBCDatabaseService;
import com.l2jserver.service.database.AbstractJDBCDatabaseService;
/**
* {@link AbstractDAO} for JDBC DAO implementation
@@ -38,7 +38,7 @@ public abstract class AbstractJDBCDAO<T extends Model<?>, I extends ID<?>>
/**
* The JDBC Database Service
*/
protected final JDBCDatabaseService database;
protected final AbstractJDBCDatabaseService database;
/**
* @param database
@@ -47,6 +47,6 @@ public abstract class AbstractJDBCDAO<T extends Model<?>, I extends ID<?>>
@Inject
protected AbstractJDBCDAO(DatabaseService database) {
super(database);
this.database = (JDBCDatabaseService) database;
this.database = (AbstractJDBCDatabaseService) database;
}
}

1
l2jserver2-gameserver/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/log

Some files were not shown because too many files have changed in this diff Show More