1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-05 23:22:47 +00:00

Updated maven dependencies

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-29 20:31:09 -03:00
parent 537b3968a9
commit 7663647fd1
5 changed files with 206 additions and 13 deletions

14
pom.xml
View File

@@ -46,7 +46,7 @@
<type>jar</type>
<scope>runtime</scope>
</dependency>
<!-- logging -->
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@@ -72,14 +72,14 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.154</version>
<version>1.3.155</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
<version>1.4</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
@@ -122,23 +122,23 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<version>2.0.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
<version>1.5.6</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>20040616</version>
<version>3.2.1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>

View File

@@ -73,4 +73,43 @@ public interface JDBCDatabaseConfiguration extends DatabaseConfiguration {
*/
@ConfigurationPropertySetter(name = "jdbc.password")
void setPassword(String password);
/**
* @return the maximum number of active connections
*/
@ConfigurationPropertyGetter(name = "jdbc.active.max", defaultValue = "20")
int getMaxActiveConnections();
/**
* @param password
* the maximum number of active connections
*/
@ConfigurationPropertySetter(name = "jdbc.active.max")
void setMaxActiveConnections(int password);
/**
* @return the maximum number of idle connections
*/
@ConfigurationPropertyGetter(name = "jdbc.idle.max", defaultValue = "20")
int getMaxIdleConnections();
/**
* @param password
* the maximum number of idle connections
*/
@ConfigurationPropertySetter(name = "jdbc.idle.max")
void setMaxIdleConnections(int password);
/**
* @return the minimum number of idle connections
*/
@ConfigurationPropertyGetter(name = "jdbc.idle.min", defaultValue = "5")
int getMinIdleConnections();
/**
* @param password
* the minimum number of idle connections
*/
@ConfigurationPropertySetter(name = "jdbc.idle.min")
void setMinIdleConnections(int password);
}

View File

@@ -33,7 +33,6 @@ import org.apache.commons.dbcp.DriverManagerConnectionFactory;
import org.apache.commons.dbcp.PoolableConnectionFactory;
import org.apache.commons.dbcp.PoolingDataSource;
import org.apache.commons.io.FileUtils;
import org.apache.commons.pool.ObjectPool;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,7 +82,7 @@ public class JDBCDatabaseService extends AbstractService implements
/**
* The database connection pool
*/
private ObjectPool connectionPool;
private GenericObjectPool connectionPool;
/**
* The dayabase connection factory
*/
@@ -113,10 +112,18 @@ public class JDBCDatabaseService extends AbstractService implements
@Override
protected void doStart() throws ServiceStartException {
connectionPool = new GenericObjectPool(null);
connectionPool.setMaxActive(config.getMaxActiveConnections());
connectionPool.setMinIdle(config.getMinIdleConnections());
connectionPool.setMaxIdle(config.getMaxIdleConnections());
// test if connections are active while idle
connectionPool.setTestWhileIdle(true);
connectionFactory = new DriverManagerConnectionFactory(
config.getJdbcUrl(), config.getUsername(), config.getPassword());
poolableConnectionFactory = new PoolableConnectionFactory(
connectionFactory, connectionPool, null, null, false, true);
connectionFactory, connectionPool, null, "SELECT 1", false,
true);
dataSource = new PoolingDataSource(connectionPool);
// cache must be large enough for all world objects, to avoid
@@ -127,7 +134,6 @@ public class JDBCDatabaseService extends AbstractService implements
@Override
public void install() {
@SuppressWarnings("unchecked")
Collection<File> files = FileUtils.listFiles(new File("dist/sql/h2"),
new String[] { "sql" }, false);
try {

View File

@@ -34,8 +34,157 @@ public class AStarPathingService extends AbstractService implements
PathingService {
@Override
public Path findPath(PositionableObject object, Point3D point) {
// TODO Auto-generated method stub
return null;
}
// public class Position {
// private double x;
//
// private double y;
// }
//
// public class Node {
//
// protected String id;
// }
//
// public class Edge {
//
// protected String from;
//
// protected String to;
//
// }
//
// public class Adjacency<N extends Node> {
// protected N node;
// protected Set<N> neighbors;
// }
//
// public class Graph<N extends Node, E extends Edge> {
//
// protected List<N> nodeList;
//
// protected List<E> edgeList;
//
// // Index for fast access
// private Map<String, Adjacency<N>> adjacency;
//
// // directed graph or not
// protected boolean diGraph;
// }
//
// public class NavNode extends Node {
// protected Position position;
// protected List<String> extraData;
// }
//
// public class NavEdge extends Edge {
// protected double cost;
// }
//
// public class NavGraph extends Graph<NavNode, NavEdge> {
//
// public void addConnection(String firstId, String secondId) {
// NavNode node1 = this.getNode(firstId);
// NavNode node2 = this.getNode(secondId);
// if (node1 != null && node2 != null) {
// double cost = this.calcManhattanDistance(node1, node2);
// NavEdge edge1 = new NavEdge(firstId, secondId, cost);
// NavEdge edge2 = new NavEdge(secondId, firstId, cost);
// this.addEdge(edge1);
// this.addEdge(edge2);
// }
// }
//
// public void removeConnection(String firstId, String secondId) {
// NavEdge edge1 = new NavEdge(firstId, secondId);
// NavEdge edge2 = new NavEdge(secondId, firstId);
// this.removeEdge(edge1);
// this.removeEdge(edge2);
// }
//
// public double calcManhattanDistance(NavNode a, NavNode b) {
// return abs(a.getPosition().getX() - b.getPosition().getX())
// + abs(a.getPosition().getY() - b.getPosition().getY());
// }
// }
//
// public class NavGraphLoader {
//
// public NavGraphData load(String filePath) {
// try {
// String json = this.readFileAsString(filePath);
// JSONReader reader = new JSONReader();
// Map map = (Map) reader.read(json);
// NavGraphData data = new NavGraphData();
// data.fromJSON(map);
//
// return data;
// } catch (IOException e) {
// throw new RuntimeException("Cannot read file " + filePath);
// }
// }
//
// String readFileAsString(String filePath) throws java.io.IOException {
// BufferedReader reader = new BufferedReader(new InputStreamReader(
// this.getClass().getResourceAsStream(filePath)));
// StringBuffer sb = new StringBuffer(4096);
//
// String line = reader.readLine();
// while (line != null) {
// sb.append(line);
// line = reader.readLine();
// }
//
// reader.close();
//
// return sb.toString();
// }
// }
//
// public class NavNodeData {
// private int min;
// private int max;
// private NavNode node;
//
// public NavNodeData() {
// }
//
// public NavNodeData(int min, int max, NavNode node) {
// this.min = min;
// this.max = max;
// this.node = node;
// }
//
// public int getMin() {
// return min;
// }
//
// public void setMin(int min) {
// this.min = min;
// }
//
// public int getMax() {
// return max;
// }
//
// public void setMax(int max) {
// this.max = max;
// }
//
// public NavNode getNode() {
// return node;
// }
//
// public void setNode(NavNode node) {
// this.node = node;
// }
// }
//
// public class MatrixPosition {
//
// private int row;
// private int column;
// }
}

View File

@@ -134,7 +134,6 @@ public class ScriptContextImpl implements ScriptContext {
ScriptCompiler scriptCompiler = instantiateCompiler();
@SuppressWarnings("unchecked")
Collection<File> files = FileUtils.listFiles(root,
scriptCompiler.getSupportedFileTypes(), true);