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

Merge branch 'proposed/database-derby'

Conflicts:
	pom.xml
This commit is contained in:
2011-10-06 01:03:26 -03:00
35 changed files with 1114 additions and 365 deletions

View File

@@ -4,10 +4,11 @@
<parent> <parent>
<artifactId>l2jserver2</artifactId> <artifactId>l2jserver2</artifactId>
<groupId>com.l2jserver</groupId> <groupId>com.l2jserver</groupId>
<version>2.0.0</version> <version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<artifactId>l2jserver2-common</artifactId> <artifactId>l2jserver2-common</artifactId>
<dependencies> <dependencies>
<!-- junit --> <!-- junit -->
<dependency> <dependency>
@@ -17,131 +18,93 @@
<type>jar</type> <type>jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<!-- netty --> <!-- netty -->
<dependency> <dependency>
<groupId>org.jboss.netty</groupId> <groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId> <artifactId>netty</artifactId>
<version>3.2.4.Final</version> <version>3.2.4.Final</version>
<scope>runtime</scope>
</dependency> </dependency>
<!-- google guice --> <!-- google guice -->
<dependency> <dependency>
<groupId>com.google.inject</groupId> <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId> <artifactId>guice</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject.extensions</groupId> <groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId> <artifactId>guice-assistedinject</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject.extensions</groupId> <groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId> <artifactId>guice-multibindings</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- logging --> <!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId> <artifactId>jcl-over-slf4j</artifactId>
<version>1.6.1</version> <version>1.6.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- database --> <!-- 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> <dependency>
<groupId>commons-dbcp</groupId> <groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId> <artifactId>commons-dbcp</artifactId>
<version>1.4</version> <version>1.4</version>
<type>jar</type> </dependency>
<scope>runtime</scope> <dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-core</artifactId>
<version>1.0rc5</version>
</dependency> </dependency>
<!-- cache --> <!-- cache -->
<dependency> <dependency>
<groupId>net.sf.ehcache</groupId> <groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId> <artifactId>ehcache-core</artifactId>
<version>2.4.2</version> <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> </dependency>
<!-- utils --> <!-- utils -->
<dependency> <dependency>
<groupId>javolution</groupId> <groupId>javolution</groupId>
<artifactId>javolution</artifactId> <artifactId>javolution</artifactId>
<version>5.5.1</version> <version>5.5.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>10.0</version> <version>10.0</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.0.1</version> <version>2.0.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-pool</groupId> <groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId> <artifactId>commons-pool</artifactId>
<version>1.5.6</version> <version>1.5.6</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-collections</groupId> <groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId> <artifactId>commons-collections</artifactId>
<version>3.2.1</version> <version>3.2.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId> <artifactId>commons-math</artifactId>
<version>2.2</version> <version>2.2</version>
<type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<name>L2JServer 2 - Commons module</name>
<url>http://github.com/l2jserver2</url>
<description>Lineage II server emulator</description>
<inceptionYear>2011</inceptionYear>
</project> </project>

View File

@@ -1,51 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> 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> <modelVersion>4.0.0</modelVersion>
<groupId>com.l2jserver</groupId>
<artifactId>l2jserver2-gameserver</artifactId> <artifactId>l2jserver2-gameserver</artifactId>
<version>2.0.0</version> <name>L2JServer 2 - Game server module</name>
<name>L2JServer - Game Server</name>
<description>Lineage II server emulator</description> <description>Lineage II server emulator</description>
<inceptionYear>2011</inceptionYear>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/l2jserver2/l2jserver2-gs/issues</url>
</issueManagement>
<ciManagement>
<system>GitHub</system>
<url>https://github.com/l2jserver2/l2jserver2-gs/wiki</url>
</ciManagement>
<developers>
<developer>
<id>rogiel</id>
<name>Rogiel</name>
<email>rogiel@rogiel.com</email>
<url>http://www.rogiel.com/</url>
<timezone>-3</timezone>
<roles>
<role>Creator</role>
<role>API Designer</role>
</roles>
</developer>
</developers>
<scm>
<connection>git://github.com/l2jserver2/l2jserver2-gs.git</connection>
<developerConnection>ssh://git@github.com:l2jserver2/l2jserver2-gs.git</developerConnection>
<tag>master</tag>
<url>https://github.com/l2jserver2/l2jserver2-gs</url>
</scm>
<licenses>
<license>
<name>GNU General Public License version 3</name>
<url>http://www.gnu.org/licenses/gpl.txt</url>
<distribution>manual</distribution>
</license>
</licenses>
<build> <build>
<defaultGoal>package</defaultGoal> <defaultGoal>package</defaultGoal>
@@ -93,9 +51,19 @@
<descriptors> <descriptors>
<descriptor>src/assembly/distribution-mysql5-bin.xml</descriptor> <descriptor>src/assembly/distribution-mysql5-bin.xml</descriptor>
<descriptor>src/assembly/distribution-h2-bin.xml</descriptor> <descriptor>src/assembly/distribution-h2-bin.xml</descriptor>
<descriptor>src/assembly/distribution-orientdb-bin.xml</descriptor>
<descriptor>src/assembly/distribution-derby-bin.xml</descriptor>
<descriptor>src/assembly/distribution-src.xml</descriptor> <descriptor>src/assembly/distribution-src.xml</descriptor>
</descriptors> </descriptors>
</configuration> </configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@@ -105,7 +73,7 @@
<dependency> <dependency>
<groupId>com.l2jserver</groupId> <groupId>com.l2jserver</groupId>
<artifactId>l2jserver2-common</artifactId> <artifactId>l2jserver2-common</artifactId>
<version>2.0.0</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- junit --> <!-- junit -->
@@ -122,7 +90,6 @@
<groupId>org.jboss.netty</groupId> <groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId> <artifactId>netty</artifactId>
<version>3.2.4.Final</version> <version>3.2.4.Final</version>
<scope>runtime</scope>
</dependency> </dependency>
<!-- google guice --> <!-- google guice -->
<dependency> <dependency>
@@ -130,21 +97,18 @@
<artifactId>guice</artifactId> <artifactId>guice</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject.extensions</groupId> <groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId> <artifactId>guice-assistedinject</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject.extensions</groupId> <groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId> <artifactId>guice-multibindings</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- logging --> <!-- logging -->
<dependency> <dependency>
@@ -159,7 +123,6 @@
<artifactId>jcl-over-slf4j</artifactId> <artifactId>jcl-over-slf4j</artifactId>
<version>1.6.1</version> <version>1.6.1</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- database --> <!-- database -->
<dependency> <dependency>
@@ -176,12 +139,23 @@
<type>jar</type> <type>jar</type>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-core</artifactId>
<version>1.0rc5</version>
<type>jar</type>
</dependency>
<dependency> <dependency>
<groupId>commons-dbcp</groupId> <groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId> <artifactId>commons-dbcp</artifactId>
<version>1.4</version> <version>1.4</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- cache --> <!-- cache -->
<dependency> <dependency>
@@ -189,7 +163,6 @@
<artifactId>ehcache-core</artifactId> <artifactId>ehcache-core</artifactId>
<version>2.4.2</version> <version>2.4.2</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- html parser/generator --> <!-- html parser/generator -->
<dependency> <dependency>
@@ -197,7 +170,6 @@
<artifactId>htmlparser</artifactId> <artifactId>htmlparser</artifactId>
<version>2.1</version> <version>2.1</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- utils --> <!-- utils -->
<dependency> <dependency>
@@ -205,64 +177,44 @@
<artifactId>javolution</artifactId> <artifactId>javolution</artifactId>
<version>5.5.1</version> <version>5.5.1</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>r09</version> <version>r09</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.0.1</version> <version>2.0.1</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-pool</groupId> <groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId> <artifactId>commons-pool</artifactId>
<version>1.5.6</version> <version>1.5.6</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-collections</groupId> <groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId> <artifactId>commons-collections</artifactId>
<version>3.2.1</version> <version>3.2.1</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId> <artifactId>commons-math</artifactId>
<version>2.2</version> <version>2.2</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<!-- vfs -->
</dependencies> </dependencies>
<parent>
<repositories> <groupId>com.l2jserver</groupId>
<repository> <artifactId>l2jserver2</artifactId>
<id>repository.jboss.org</id> <version>0.1.0-SNAPSHOT</version>
<url>https://repository.jboss.org/nexus/content/repositories/releases/ <relativePath>..</relativePath>
</url> </parent>
<snapshots> <url>http://github.com/l2jserver2</url>
<enabled>false</enabled> <inceptionYear>2011</inceptionYear>
</snapshots>
</repository>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>EclipseLink Repo</id>
<url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url>
</repository>
</repositories>
</project> </project>

View File

@@ -0,0 +1,53 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>derby-bin</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>data/**</include>
</includes>
<excludes>
<exclude>.gitignore</exclude>
<exclude>data/cache/**</exclude>
<exclude>data/pathing.db</exclude>
<exclude>data/database.h2.*</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/global</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/sql</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<excludes>
<exclude>mysql:*</exclude>
<exclude>com.h2database:*</exclude>
<exclude>com.orientechnologies:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -4,8 +4,6 @@
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>h2-bin</id> <id>h2-bin</id>
<formats> <formats>
<!-- <format>tar.gz</format> -->
<!-- <format>tar.bz2</format> -->
<format>zip</format> <format>zip</format>
</formats> </formats>
<baseDirectory></baseDirectory> <baseDirectory></baseDirectory>
@@ -46,7 +44,9 @@
<unpack>false</unpack> <unpack>false</unpack>
<scope>runtime</scope> <scope>runtime</scope>
<excludes> <excludes>
<exclude>mysql:mysql-connector-java</exclude> <exclude>mysql:*</exclude>
<exclude>org.apache.derby:*</exclude>
<exclude>com.orientechnologies:*</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>

View File

@@ -4,8 +4,6 @@
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>mysql5-bin</id> <id>mysql5-bin</id>
<formats> <formats>
<!-- <format>tar.gz</format> -->
<!-- <format>tar.bz2</format> -->
<format>zip</format> <format>zip</format>
</formats> </formats>
<baseDirectory></baseDirectory> <baseDirectory></baseDirectory>
@@ -46,7 +44,9 @@
<unpack>false</unpack> <unpack>false</unpack>
<scope>runtime</scope> <scope>runtime</scope>
<excludes> <excludes>
<exclude>com.h2database:h2</exclude> <exclude>com.h2database:*</exclude>
<exclude>org.apache.derby:*</exclude>
<exclude>com.orientechnologies:*</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>

View File

@@ -0,0 +1,53 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>orientdb-bin</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>data/**</include>
</includes>
<excludes>
<exclude>.gitignore</exclude>
<exclude>data/cache/**</exclude>
<exclude>data/pathing.db</exclude>
<exclude>data/database.h2.*</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/global</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/distribution/sql</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>false</unpack>
<scope>runtime</scope>
<excludes>
<exclude>mysql:*</exclude>
<exclude>com.h2database:*</exclude>
<exclude>org.apache.derby:*</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>

View File

@@ -4,8 +4,6 @@
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>src</id> <id>src</id>
<formats> <formats>
<!-- <format>tar.gz</format> -->
<!-- <format>tar.bz2</format> -->
<format>zip</format> <format>zip</format>
</formats> </formats>
<baseDirectory></baseDirectory> <baseDirectory></baseDirectory>

View File

@@ -0,0 +1,57 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.dao.CharacterFriendDAO;
import com.l2jserver.model.dao.ChatMessageDAO;
import com.l2jserver.model.dao.ClanDAO;
import com.l2jserver.model.dao.ItemDAO;
import com.l2jserver.model.dao.NPCDAO;
import com.l2jserver.service.database.jdbc.derby.DerbyCharacterDAO;
import com.l2jserver.service.database.jdbc.derby.DerbyCharacterFriendDAO;
import com.l2jserver.service.database.jdbc.derby.DerbyChatMessageDAO;
import com.l2jserver.service.database.jdbc.derby.DerbyClanDAO;
import com.l2jserver.service.database.jdbc.derby.DerbyItemDAO;
import com.l2jserver.service.database.jdbc.derby.DerbyNPCDAO;
/**
* Google Guice {@link Module} for Derby DAOs
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class DerbyDAOModule extends AbstractModule {
@Override
protected void configure() {
bind(CharacterDAO.class).to(DerbyCharacterDAO.class).in(
Scopes.SINGLETON);
bind(CharacterFriendDAO.class).to(DerbyCharacterFriendDAO.class).in(
Scopes.SINGLETON);
bind(NPCDAO.class).to(DerbyNPCDAO.class).in(Scopes.SINGLETON);
bind(ItemDAO.class).to(DerbyItemDAO.class).in(Scopes.SINGLETON);
bind(ClanDAO.class).to(DerbyClanDAO.class).in(Scopes.SINGLETON);
// logs
bind(ChatMessageDAO.class).to(DerbyChatMessageDAO.class).in(
Scopes.SINGLETON);
}
}

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.service.database;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.service.database.orientdb.OrientDBCharacterDAO;
/**
* Google Guice {@link Module} for Orient Database DAOs
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class OrientDBDAOModule extends AbstractModule {
@Override
protected void configure() {
bind(CharacterDAO.class).to(OrientDBCharacterDAO.class).in(
Scopes.SINGLETON);
// bind(CharacterFriendDAO.class).to(OrientDBCharacterFriendDAO.class).in(
// Scopes.SINGLETON);
//
// bind(NPCDAO.class).to(OrientDBNPCDAO.class).in(Scopes.SINGLETON);
//
// bind(ItemDAO.class).to(OrientDBItemDAO.class).in(Scopes.SINGLETON);
// bind(ClanDAO.class).to(OrientDBClanDAO.class).in(Scopes.SINGLETON);
//
// // logs
// bind(ChatMessageDAO.class).to(OrientDBChatMessageDAO.class).in(
// Scopes.SINGLETON);
}
}

View File

@@ -0,0 +1,55 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database.jdbc.derby;
import com.google.inject.Inject;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
import com.l2jserver.model.id.object.provider.ClanIDProvider;
import com.l2jserver.model.id.provider.AccountIDProvider;
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.jdbc.JDBCCharacterDAO;
/**
* {@link CharacterDAO} implementation for MySQL5
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class DerbyCharacterDAO extends JDBCCharacterDAO implements
CharacterDAO {
/**
* @param database
* the database service
* @param idFactory
* the character id provider
* @param templateIdFactory
* the template id provider
* @param accountIdFactory
* the account id provider
* @param clanIdFactory
* the clan id provider
*/
@Inject
public DerbyCharacterDAO(DatabaseService database,
CharacterIDProvider idFactory,
CharacterTemplateIDProvider templateIdFactory,
AccountIDProvider accountIdFactory, ClanIDProvider clanIdFactory) {
super(database, idFactory, templateIdFactory, accountIdFactory,
clanIdFactory);
}
}

View File

@@ -0,0 +1,46 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database.jdbc.derby;
import com.google.inject.Inject;
import com.l2jserver.model.dao.CharacterFriendDAO;
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
import com.l2jserver.model.id.provider.FriendIDProvider;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.jdbc.JDBCCharacterFriendDAO;
/**
* {@link CharacterFriendDAO} implementation for MySQL5
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class DerbyCharacterFriendDAO extends JDBCCharacterFriendDAO implements
CharacterFriendDAO {
/**
* @param database
* the database service
* @param idProvider
* the frind id provider
* @param charIdProvider
* the character id provider
*/
@Inject
public DerbyCharacterFriendDAO(DatabaseService database,
FriendIDProvider idProvider, CharacterIDProvider charIdProvider) {
super(database, idProvider, charIdProvider);
}
}

View File

@@ -0,0 +1,46 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database.jdbc.derby;
import com.google.inject.Inject;
import com.l2jserver.model.dao.ChatMessageDAO;
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
import com.l2jserver.model.id.provider.ChatMessageIDProvider;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.jdbc.JDBCChatMessageDAO;
/**
* {@link ChatMessageDAO} implementation for MySQL5
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class DerbyChatMessageDAO extends JDBCChatMessageDAO implements
ChatMessageDAO {
/**
* @param database
* the database service
* @param idFactory
* the chat message id provider
* @param charIdFactory
* the character id provider
*/
@Inject
public DerbyChatMessageDAO(DatabaseService database,
ChatMessageIDProvider idFactory, CharacterIDProvider charIdFactory) {
super(database, idFactory, charIdFactory);
}
}

View File

@@ -14,31 +14,33 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>. * along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/ */
package com.l2jserver.service.database.orientdb; package com.l2jserver.service.database.jdbc.derby;
import com.l2jserver.model.Model; import com.google.inject.Inject;
import com.l2jserver.model.id.ID; import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.service.database.AbstractDAO; import com.l2jserver.model.dao.ClanDAO;
import com.l2jserver.service.database.AbstractOrientDatabaseService; import com.l2jserver.model.id.object.provider.CharacterIDProvider;
import com.l2jserver.model.id.object.provider.ClanIDProvider;
import com.l2jserver.service.database.DatabaseService; import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.jdbc.JDBCClanDAO;
/** /**
* {@link CharacterDAO} implementation for MySQL5
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
* @param <T>
* the model type
* @param <I>
* the id type
*/ */
public abstract class AbstractOrientDBDAO<T extends Model<?>, I extends ID<?>> public class DerbyClanDAO extends JDBCClanDAO implements ClanDAO {
extends AbstractDAO<T, I> {
protected final AbstractOrientDatabaseService database;
/** /**
* @param database * @param database
* the database instance * the database service
* @param clanIdFactory
* the clan id provider
* @param idFactory
* the character id provider
*/ */
protected AbstractOrientDBDAO(DatabaseService database) { @Inject
super(database); public DerbyClanDAO(DatabaseService database,
this.database = (AbstractOrientDatabaseService) database; ClanIDProvider clanIdFactory, CharacterIDProvider idFactory) {
super(database, clanIdFactory, idFactory);
} }
} }

View File

@@ -0,0 +1,49 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database.jdbc.derby;
import com.google.inject.Inject;
import com.l2jserver.model.dao.ItemDAO;
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
import com.l2jserver.model.id.object.provider.ItemIDProvider;
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.jdbc.JDBCItemDAO;
/**
* {@link ItemDAO} implementation for MySQL5
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class DerbyItemDAO extends JDBCItemDAO implements ItemDAO {
/**
* @param database
* the database service
* @param idFactory
* the item id provider
* @param templateIdFactory
* the item template id provider
* @param charIdFactory
* the character id provider
*/
@Inject
public DerbyItemDAO(DatabaseService database, ItemIDProvider idFactory,
ItemTemplateIDProvider templateIdFactory,
CharacterIDProvider charIdFactory) {
super(database, idFactory, templateIdFactory, charIdFactory);
}
}

View File

@@ -0,0 +1,46 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database.jdbc.derby;
import com.google.inject.Inject;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.dao.NPCDAO;
import com.l2jserver.model.id.object.provider.NPCIDProvider;
import com.l2jserver.model.id.template.provider.NPCTemplateIDProvider;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.jdbc.JDBCNPCDAO;
/**
* {@link CharacterDAO} implementation for MySQL5
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class DerbyNPCDAO extends JDBCNPCDAO implements NPCDAO {
/**
* @param database
* the database service
* @param idProvider
* the npc id provider
* @param templateIdProvider
* the npc template id provider
*/
@Inject
public DerbyNPCDAO(DatabaseService database, NPCIDProvider idProvider,
NPCTemplateIDProvider templateIdProvider) {
super(database, idProvider, templateIdProvider);
}
}

View File

@@ -0,0 +1,282 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database.orientdb;
import java.sql.SQLException;
import java.util.List;
import com.google.inject.Inject;
import com.l2jserver.model.dao.CharacterFriendDAO;
import com.l2jserver.model.game.CharacterFriend;
import com.l2jserver.model.id.FriendID;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
import com.l2jserver.model.id.provider.FriendIDProvider;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.character.CharacterFriendList;
import com.l2jserver.service.database.AbstractOrientDatabaseService.CachedMapper;
import com.l2jserver.service.database.AbstractOrientDatabaseService.InsertUpdateQuery;
import com.l2jserver.service.database.AbstractOrientDatabaseService.Mapper;
import com.l2jserver.service.database.AbstractOrientDatabaseService.SelectListQuery;
import com.l2jserver.service.database.AbstractOrientDatabaseService.SelectSingleQuery;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.database.jdbc.JDBCCharacterDAO;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.query.nativ.ONativeSynchQuery;
import com.orientechnologies.orient.core.query.nativ.OQueryContextNativeSchema;
import com.orientechnologies.orient.core.record.impl.ODocument;
/**
* {@link CharacterFriendDAO} implementation for JDBC
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class OrientDBCharacterFriendDAO extends
AbstractOrientDBDAO<CharacterFriend, FriendID> implements
CharacterFriendDAO {
/**
* The {@link FriendID} provider
*/
private final FriendIDProvider idProvider;
/**
* The {@link CharacterID} provider
*/
private final CharacterIDProvider charIdProvider;
/**
* Character table name
*/
public static final String CLASS_NAME = CharacterFriend.class
.getSimpleName();
// FIELDS
public static final String CHAR_ID = JDBCCharacterDAO.CHAR_ID;
public static final String CHAR_ID_FRIEND = JDBCCharacterDAO.CHAR_ID
+ "_friend";
/**
* @param database
* the database service
* @param idProvider
* the frind id provider
* @param charIdProvider
* the character id provider
*/
@Inject
public OrientDBCharacterFriendDAO(DatabaseService database,
final FriendIDProvider idProvider,
CharacterIDProvider charIdProvider) {
super(database);
this.idProvider = idProvider;
this.charIdProvider = charIdProvider;
}
/**
* The {@link Mapper} for {@link FriendID}
*/
private final Mapper<FriendID> idMapper = new Mapper<FriendID>() {
@Override
public FriendID map(ODocument document) throws SQLException {
final CharacterID characterId = charIdProvider
.resolveID((Integer) document.field(CHAR_ID));
final CharacterID friendId = charIdProvider
.resolveID((Integer) document.field(CHAR_ID_FRIEND));
return idProvider.createID(characterId, friendId);
}
};
/**
* The {@link Mapper} for {@link CharacterFriend}
*/
private final Mapper<CharacterFriend> mapper = new CachedMapper<CharacterFriend, FriendID>(
database, idMapper) {
@Override
protected CharacterFriend map(FriendID id, ODocument document)
throws SQLException {
return new CharacterFriend(id);
}
};
@Override
public CharacterFriend select(final FriendID id) {
return database.query(new SelectSingleQuery<CharacterFriend>() {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database) {
return new ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>>(
database, CLASS_NAME,
new OQueryContextNativeSchema<ODocument>()) {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(
OQueryContextNativeSchema<ODocument> criteria) {
return criteria.field(CHAR_ID).eq(id.getID1().getID())
.field(CHAR_ID_FRIEND).eq(id.getID2().getID())
.go();
};
};
}
@Override
protected Mapper<CharacterFriend> mapper() {
return mapper;
}
});
}
@Override
public void load(final L2Character character) {
final List<CharacterFriend> list = database
.query(new SelectListQuery<CharacterFriend>() {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database) {
return new ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>>(
database, CLASS_NAME,
new OQueryContextNativeSchema<ODocument>()) {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(
OQueryContextNativeSchema<ODocument> criteria) {
return criteria.field(CHAR_ID)
.eq(character.getID().getID()).go();
};
};
}
@Override
protected Mapper<CharacterFriend> mapper() {
return mapper;
}
});
character.getFriendList().load(list);
}
@Override
public List<FriendID> selectIDs() {
return database.query(new SelectListQuery<FriendID>() {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database) {
return new ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>>(
database, CLASS_NAME,
new OQueryContextNativeSchema<ODocument>()) {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(
OQueryContextNativeSchema<ODocument> criteria) {
return true;
};
};
}
@Override
protected Mapper<FriendID> mapper() {
return idMapper;
}
});
}
@Override
public boolean insert(CharacterFriend friend) {
return database.query(new InsertUpdateQuery<CharacterFriend>(friend) {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database, CharacterFriend object) {
return null;
}
@Override
protected ODocument update(ODocument document,
CharacterFriend object) throws SQLException {
return null;
}
@Override
protected ODocument insert(ODocument document,
CharacterFriend friend) throws SQLException {
document.field(CHAR_ID, friend.getCharacterID());
document.field(CHAR_ID_FRIEND, friend.getFriendID());
return document;
}
}) > 0;
}
@Override
public boolean update(CharacterFriend friend) {
// it is not possible update friend objects, because they are only a ID
// pair and IDs are immutable
return false;
}
@Override
public boolean delete(CharacterFriend friend) {
return database.query(new InsertUpdateQuery<CharacterFriend>(friend) {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database, final CharacterFriend friend) {
return new ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>>(
database, CLASS_NAME,
new OQueryContextNativeSchema<ODocument>()) {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(
OQueryContextNativeSchema<ODocument> criteria) {
return criteria.field(CHAR_ID)
.eq(friend.getCharacterID().getID()).and()
.field(CHAR_ID_FRIEND)
.eq(friend.getFriendID().getID()).go();
};
};
}
@Override
protected ODocument update(ODocument document,
CharacterFriend object) throws SQLException {
document.delete();
return null;
}
@Override
protected ODocument insert(ODocument document,
CharacterFriend friend) throws SQLException {
return null;
}
}) > 0;
}
@Override
public boolean save(final CharacterFriendList friends) {
for (final CharacterFriend friend : friends) {
if (!save(friend))
return false;
}
return true;
}
@Override
public boolean delete(final CharacterFriendList friends) {
for (final CharacterFriend friend : friends) {
if (!delete(friend))
return false;
}
return true;
}
}

View File

@@ -0,0 +1,259 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.service.database.orientdb;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import com.google.inject.Inject;
import com.l2jserver.model.dao.CharacterDAO;
import com.l2jserver.model.dao.ChatMessageDAO;
import com.l2jserver.model.id.ChatMessageID;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.id.object.provider.CharacterIDProvider;
import com.l2jserver.model.id.provider.ChatMessageIDProvider;
import com.l2jserver.model.server.ChatMessage;
import com.l2jserver.service.database.AbstractOrientDatabaseService.CachedMapper;
import com.l2jserver.service.database.AbstractOrientDatabaseService.InsertUpdateQuery;
import com.l2jserver.service.database.AbstractOrientDatabaseService.Mapper;
import com.l2jserver.service.database.AbstractOrientDatabaseService.SelectListQuery;
import com.l2jserver.service.database.AbstractOrientDatabaseService.SelectSingleQuery;
import com.l2jserver.service.database.DatabaseService;
import com.l2jserver.service.game.chat.ChatMessageType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.query.nativ.ONativeSynchQuery;
import com.orientechnologies.orient.core.query.nativ.OQueryContextNativeSchema;
import com.orientechnologies.orient.core.record.impl.ODocument;
/**
* {@link CharacterDAO} implementation for JDBC
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class OrientDBChatMessageDAO extends
AbstractOrientDBDAO<ChatMessage, ChatMessageID> implements
ChatMessageDAO {
/**
* The {@link ChatMessageID} factory
*/
private final ChatMessageIDProvider idFactory;
/**
* The {@link CharacterID} factory
*/
private final CharacterIDProvider charIdFactory;
/**
* Character table name
*/
public static final String CLASS_NAME = ChatMessage.class.getSimpleName();
// FIELDS
public static final String MESSAGE_ID = "message_id";
public static final String TYPE = "type";
public static final String CHANNEL_ID = "channel_id";
public static final String SENDER = "sender";
public static final String DATE = "date";
public static final String MESSAGE = "message";
/**
* @param database
* the database service
* @param idFactory
* the chat message id provider
* @param charIdFactory
* the character id provider
*/
@Inject
public OrientDBChatMessageDAO(DatabaseService database,
ChatMessageIDProvider idFactory,
final CharacterIDProvider charIdFactory) {
super(database);
this.idFactory = idFactory;
this.charIdFactory = charIdFactory;
}
/**
* The {@link Mapper} for {@link ChatMessageID}
*/
private final Mapper<ChatMessageID> idMapper = new Mapper<ChatMessageID>() {
@Override
public ChatMessageID map(ODocument document) throws SQLException {
return idFactory.resolveID((Integer) document.field(MESSAGE_ID));
}
};
/**
* The {@link Mapper} for {@link ChatMessage}
*/
private final Mapper<ChatMessage> mapper = new CachedMapper<ChatMessage, ChatMessageID>(
database, idMapper) {
@Override
protected ChatMessage map(ChatMessageID id, ODocument document)
throws SQLException {
final ChatMessage message = new ChatMessage();
message.setID(id);
message.setType(ChatMessageType.valueOf((String) document
.field(TYPE)));
switch (message.getType()) {
case SHOUT:
message.setTarget(charIdFactory.resolveID((Integer) document
.field(CHANNEL_ID)));
break;
default:
message.setChannelID((Integer) document.field(CHANNEL_ID));
break;
}
message.setSender(charIdFactory.resolveID((Integer) document
.field(SENDER)));
message.setDate((Date) document.field(DATE));
message.setMessage((String) document.field(MESSAGE));
return message;
}
};
@Override
public ChatMessage select(final ChatMessageID id) {
return database.query(new SelectSingleQuery<ChatMessage>() {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database) {
return new ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>>(
database, CLASS_NAME,
new OQueryContextNativeSchema<ODocument>()) {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(
OQueryContextNativeSchema<ODocument> criteria) {
return criteria.field(MESSAGE_ID).eq(id.getID()).go();
};
};
}
@Override
protected Mapper<ChatMessage> mapper() {
return mapper;
}
});
}
@Override
public List<ChatMessageID> selectIDs() {
return database.query(new SelectListQuery<ChatMessageID>() {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database) {
return new ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>>(
database, CLASS_NAME,
new OQueryContextNativeSchema<ODocument>()) {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(
OQueryContextNativeSchema<ODocument> criteria) {
return true;
};
};
}
@Override
protected Mapper<ChatMessageID> mapper() {
return idMapper;
}
});
}
@Override
public boolean insert(ChatMessage message) {
return database.query(new InsertUpdateQuery<ChatMessage>(message) {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database, ChatMessage object) {
return null;
}
@Override
protected ODocument update(ODocument document, ChatMessage object)
throws SQLException {
return null;
}
@Override
protected ODocument insert(ODocument document, ChatMessage message)
throws SQLException {
document.field(TYPE, message.getType().name());
switch (message.getType()) {
case SHOUT:
document.field(CHANNEL_ID, message.getTarget().getID());
break;
default:
document.field(CHANNEL_ID, message.getChannelID());
break;
}
document.field(SENDER, message.getTarget().getID());
document.field(DATE, message.getDate());
document.field(MESSAGE, message.getMessage());
return document;
}
}) > 0;
}
@Override
public boolean update(ChatMessage message) {
// cannot update chat message logs
return false;
}
@Override
public boolean delete(ChatMessage message) {
return database.query(new InsertUpdateQuery<ChatMessage>(message) {
@Override
protected ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>> createQuery(
ODatabaseDocumentTx database, final ChatMessage message) {
return new ONativeSynchQuery<ODocument, OQueryContextNativeSchema<ODocument>>(
database, CLASS_NAME,
new OQueryContextNativeSchema<ODocument>()) {
private static final long serialVersionUID = 1L;
@Override
public boolean filter(
OQueryContextNativeSchema<ODocument> criteria) {
return criteria.field(MESSAGE_ID).eq(message.getID())
.and().go();
};
};
}
@Override
protected ODocument update(ODocument document, ChatMessage object)
throws SQLException {
document.delete();
return null;
}
@Override
protected ODocument insert(ODocument document, ChatMessage object)
throws SQLException {
// TODO Auto-generated method stub
return null;
}
}) > 0;
}
}

View File

@@ -4,38 +4,41 @@
<parent> <parent>
<artifactId>l2jserver2</artifactId> <artifactId>l2jserver2</artifactId>
<groupId>com.l2jserver</groupId> <groupId>com.l2jserver</groupId>
<version>2.0.0</version> <version>0.1.0-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>..</relativePath>
</parent> </parent>
<artifactId>l2jserver2-loginserver</artifactId> <artifactId>l2jserver2-loginserver</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>com.l2jserver</groupId>
<artifactId>l2jserver2-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.8.2</version> <version>4.8.2</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jboss.netty</groupId> <groupId>org.jboss.netty</groupId>
<artifactId>netty</artifactId> <artifactId>netty</artifactId>
<version>3.2.4.Final</version> <version>3.2.4.Final</version>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject</groupId> <groupId>com.google.inject</groupId>
<artifactId>guice</artifactId> <artifactId>guice</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.inject.extensions</groupId> <groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId> <artifactId>guice-assistedinject</artifactId>
<version>3.0</version> <version>3.0</version>
<type>jar</type> <type>jar</type>
<scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
@@ -51,13 +54,6 @@
<type>jar</type> <type>jar</type>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>javacc</groupId>
<artifactId>javacc</artifactId>
<version>4.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
@@ -79,10 +75,9 @@
<type>jar</type> <type>jar</type>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>com.l2jserver</groupId>
<artifactId>l2jserver2-common</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies> </dependencies>
<name>L2JServer 2 - Login server module</name>
<url>http://github.com/l2jserver2</url>
<description>Lineage II server emulator</description>
<inceptionYear>2011</inceptionYear>
</project> </project>

View File

@@ -1,17 +1,22 @@
<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"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<modelVersion>4.0.0</modelVersion> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <modelVersion>4.0.0</modelVersion>
<artifactId>l2jserver2</artifactId> <parent>
<groupId>com.l2jserver</groupId> <artifactId>l2jserver2</artifactId>
<version>2.0.0</version> <groupId>com.l2jserver</groupId>
<relativePath>..</relativePath> <version>0.1.0-SNAPSHOT</version>
</parent> <relativePath>..</relativePath>
<artifactId>l2jserver2-tools</artifactId> </parent>
<dependencies> <artifactId>l2jserver2-tools</artifactId>
<dependency> <dependencies>
<groupId>com.l2jserver</groupId> <dependency>
<artifactId>l2jserver2-gameserver</artifactId> <groupId>com.l2jserver</groupId>
<version>2.0.0</version> <artifactId>l2jserver2-gameserver</artifactId>
</dependency> <version>${project.version}</version>
</dependencies> </dependency>
</dependencies>
<name>L2JServer 2 - Tools module</name>
<url>http://github.com/l2jserver2</url>
<description>Lineage II server emulator</description>
<inceptionYear>2011</inceptionYear>
</project> </project>

185
pom.xml
View File

@@ -3,13 +3,13 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.l2jserver</groupId> <groupId>com.l2jserver</groupId>
<artifactId>l2jserver2</artifactId> <artifactId>l2jserver2</artifactId>
<version>2.0.0</version> <version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>L2JServer - Game Server</name> <name>L2JServer 2</name>
<description>Lineage II server emulator</description> <description>Lineage II server emulator</description>
<inceptionYear>2011</inceptionYear> <inceptionYear>2011</inceptionYear>
<modules> <modules>
<module>l2jserver2-common</module> <module>l2jserver2-common</module>
<module>l2jserver2-gameserver</module> <module>l2jserver2-gameserver</module>
@@ -19,12 +19,12 @@
<issueManagement> <issueManagement>
<system>GitHub</system> <system>GitHub</system>
<url>https://github.com/l2jserver2/l2jserver2-gs/issues</url> <url>https://github.com/l2jserver2/l2jserver2/issues</url>
</issueManagement> </issueManagement>
<ciManagement> <ciManagement>
<system>GitHub</system> <system>GitHub</system>
<url>https://github.com/l2jserver2/l2jserver2-gs/wiki</url> <url>https://github.com/l2jserver2/l2jserver2/wiki</url>
</ciManagement> </ciManagement>
<developers> <developers>
@@ -42,10 +42,10 @@
</developers> </developers>
<scm> <scm>
<connection>git://github.com/l2jserver2/l2jserver2-gs.git</connection> <connection>scm:git://github.com/l2jserver2/l2jserver2.git</connection>
<developerConnection>ssh://git@github.com:l2jserver2/l2jserver2-gs.git</developerConnection> <developerConnection>scm:ssh://git@github.com:l2jserver2/l2jserver2.git</developerConnection>
<tag>master</tag> <tag>master</tag>
<url>https://github.com/l2jserver2/l2jserver2-gs</url> <url>https://github.com/l2jserver2/l2jserver2</url>
</scm> </scm>
<licenses> <licenses>
@@ -72,45 +72,17 @@
<configuration> <configuration>
<target>1.7</target> <target>1.7</target>
<source>1.7</source> <source>1.7</source>
<optimize>true</optimize>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libs/</classpathPrefix>
<mainClass>com.l2jserver.L2JGameServerMain</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>assembly</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assembly/distribution-mysql5-bin.xml</descriptor>
<descriptor>src/assembly/distribution-h2-bin.xml</descriptor>
<descriptor>src/assembly/distribution-orientdb-bin.xml</descriptor>
<descriptor>src/assembly/distribution-src.xml</descriptor>
</descriptors>
</configuration>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
<goals> <goals>
<goal>assembly</goal> <goal>jar</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
@@ -127,144 +99,12 @@
<type>jar</type> <type>jar</type>
<scope>test</scope> <scope>test</scope>
</dependency> </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>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.155</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.orientechnologies</groupId>
<artifactId>orientdb-core</artifactId>
<version>1.0rc5</version>
<scope>compile</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>r09</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> </dependencies>
<repositories> <repositories>
<repository> <repository>
<id>repository.jboss.org</id> <id>repository.jboss.org</id>
<url>https://repository.jboss.org/nexus/content/repositories/releases/ <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
</url>
<snapshots> <snapshots>
<enabled>false</enabled> <enabled>false</enabled>
</snapshots> </snapshots>
@@ -285,4 +125,5 @@
</snapshots> </snapshots>
</repository> </repository>
</repositories> </repositories>
<url>http://github.com/l2jserver2</url>
</project> </project>