Author: btellier
Date: Mon Jun 22 08:18:45 2015
New Revision: 1686807
URL: http://svn.apache.org/r1686807
Log:
MPT-16 Define SocketAddress per session - contributed by Antoine Duprat
Modified:
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/session/ExternalSessionFactory.java
Modified:
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
URL:
http://svn.apache.org/viewvc/james/mpt/trunk/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java?rev=1686807&r1=1686806&r2=1686807&view=diff
==============================================================================
---
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
(original)
+++
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/host/ExternalHostSystem.java
Mon Jun 22 08:18:45 2015
@@ -62,7 +62,12 @@ public class ExternalHostSystem extends
super(host, port, monitor, shabang);
this.userAdder = userAdder;
}
-
+
+ public ExternalHostSystem(final Monitor monitor, final String shabang,
+ final UserAdder userAdder) {
+ super(monitor, shabang);
+ this.userAdder = userAdder;
+ }
public boolean addUser(String user, String password) throws Exception {
if (userAdder == null) {
monitor.note("Please ensure user '" + user + "' with password '" +
password + "' exists.");
Modified:
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/session/ExternalSessionFactory.java
URL:
http://svn.apache.org/viewvc/james/mpt/trunk/core/src/main/java/org/apache/james/mpt/session/ExternalSessionFactory.java?rev=1686807&r1=1686806&r2=1686807&view=diff
==============================================================================
---
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/session/ExternalSessionFactory.java
(original)
+++
james/mpt/trunk/core/src/main/java/org/apache/james/mpt/session/ExternalSessionFactory.java
Mon Jun 22 08:18:45 2015
@@ -37,14 +37,23 @@ public class ExternalSessionFactory impl
protected final Monitor monitor;
protected final String shabang;
+ public ExternalSessionFactory(final Monitor monitor, final String shabang)
{
+ this(null, monitor, shabang);
+ }
+
public ExternalSessionFactory(final String host, final int port, final
Monitor monitor, final String shabang) {
+ this(new InetSocketAddress(host, port), monitor, shabang);
+ }
+
+ public ExternalSessionFactory(InetSocketAddress address, final Monitor
monitor, final String shabang) {
super();
- this.address = new InetSocketAddress(host, port);
this.monitor = monitor;
this.shabang = shabang;
+ this.address = address;
}
-
+
public Session newSession(Continuation continuation) throws Exception {
+ InetSocketAddress address = getAddress();
monitor.note("Connecting to " + address.getHostName() + ":" +
address.getPort());
final SocketChannel channel = SocketChannel.open(address);
channel.configureBlocking(false);
@@ -52,6 +61,10 @@ public class ExternalSessionFactory impl
return result;
}
+ protected InetSocketAddress getAddress() {
+ return address;
+ }
+
/**
* Constructs a <code>String</code> with all attributes
* in name = value format.
@@ -63,7 +76,7 @@ public class ExternalSessionFactory impl
final String TAB = " ";
String retValue = "ExternalSessionFactory ( "
- + "address = " + this.address + TAB
+ + "address = " + this.getAddress() + TAB
+ "monitor = " + this.monitor + TAB
+ "shabang = " + this.shabang + TAB
+ " )";
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]