Commit b33babe8 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-1309: Make Hazelcast plugin use new API

This is a fix for API changes introduced with the fix for OF-1309.
parent 286debda
...@@ -47,6 +47,7 @@ Hazelcast Clustering Plugin Changelog ...@@ -47,6 +47,7 @@ Hazelcast Clustering Plugin Changelog
<p><b>2.2.3</b> -- September 15, 2017</p> <p><b>2.2.3</b> -- September 15, 2017</p>
<ul> <ul>
<li>Use an event rather than an arbitrary delay before starting clustering</li> <li>Use an event rather than an arbitrary delay before starting clustering</li>
<li>Requires Openfire 4.2.0</li>
</ul> </ul>
<p><b>2.2.2</b> -- August 3, 2017</p> <p><b>2.2.2</b> -- August 3, 2017</p>
......
...@@ -7,5 +7,5 @@ ...@@ -7,5 +7,5 @@
<author>Tom Evans</author> <author>Tom Evans</author>
<version>2.2.3</version> <version>2.2.3</version>
<date>09/15/2017</date> <date>09/15/2017</date>
<minServerVersion>4.0.0</minServerVersion> <minServerVersion>4.2.0</minServerVersion>
</plugin> </plugin>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</parent> </parent>
<groupId>org.igniterealtime.openfire.plugins</groupId> <groupId>org.igniterealtime.openfire.plugins</groupId>
<artifactId>hazelcast</artifactId> <artifactId>hazelcast</artifactId>
<version>2.2.1</version> <version>2.2.3</version>
<name>Hazelcast Plugin</name> <name>Hazelcast Plugin</name>
<description>Adds clustering support</description> <description>Adds clustering support</description>
...@@ -35,4 +35,4 @@ ...@@ -35,4 +35,4 @@
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -49,11 +49,8 @@ public class OutgoingServerSessionTask extends RemoteSessionTask { ...@@ -49,11 +49,8 @@ public class OutgoingServerSessionTask extends RemoteSessionTask {
public void run() { public void run() {
super.run(); super.run();
if (operation == Operation.getAuthenticatedDomains) { if (operation == Operation.getOutgoingDomainPairs) {
result = ((OutgoingServerSession) getSession()).getAuthenticatedDomains(); result = ((OutgoingServerSession) getSession()).getOutgoingDomainPairs();
}
else if (operation == Operation.getHostnames) {
result = ((OutgoingServerSession) getSession()).getHostnames();
} }
else if (operation == Operation.isUsingServerDialback) { else if (operation == Operation.isUsingServerDialback) {
result = ((OutgoingServerSession) getSession()).isUsingServerDialback(); result = ((OutgoingServerSession) getSession()).isUsingServerDialback();
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.jivesoftware.openfire.plugin.session; package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.session.DomainPair;
import org.jivesoftware.openfire.session.OutgoingServerSession; import org.jivesoftware.openfire.session.OutgoingServerSession;
import org.jivesoftware.util.cache.ClusterTask; import org.jivesoftware.util.cache.ClusterTask;
import org.jivesoftware.util.cache.ExternalizableUtil; import org.jivesoftware.util.cache.ExternalizableUtil;
...@@ -40,22 +41,15 @@ public class RemoteOutgoingServerSession extends RemoteSession implements Outgoi ...@@ -40,22 +41,15 @@ public class RemoteOutgoingServerSession extends RemoteSession implements Outgoi
super(nodeID, address); super(nodeID, address);
} }
public Collection<String> getAuthenticatedDomains() { public Collection<DomainPair> getOutgoingDomainPairs()
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getAuthenticatedDomains); {
return (Collection<String>) doSynchronousClusterTask(task); ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getOutgoingDomainPairs);
return (Collection<DomainPair>) doSynchronousClusterTask(task);
} }
public void addAuthenticatedDomain(String domain) { public void addOutgoingDomainPair( String local, String remote )
doClusterTask(new AddAuthenticatedDomainTask(address, domain)); {
} doClusterTask(new AddOutgoingDomainPair(address, local, remote ));
public Collection<String> getHostnames() {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getHostnames);
return (Collection<String>) doSynchronousClusterTask(task);
}
public void addHostname(String hostname) {
doClusterTask(new AddHostnameTask(address, hostname));
} }
public boolean authenticateSubdomain(String domain, String hostname) { public boolean authenticateSubdomain(String domain, String hostname) {
...@@ -88,57 +82,34 @@ public class RemoteOutgoingServerSession extends RemoteSession implements Outgoi ...@@ -88,57 +82,34 @@ public class RemoteOutgoingServerSession extends RemoteSession implements Outgoi
return new ProcessPacketTask(this, address, packet); return new ProcessPacketTask(this, address, packet);
} }
private static class AddAuthenticatedDomainTask extends OutgoingServerSessionTask { private static class AddOutgoingDomainPair extends OutgoingServerSessionTask {
private String domain; private String local;
private String remote;
public AddAuthenticatedDomainTask() {
super();
}
protected AddAuthenticatedDomainTask(JID address, String domain) {
super(address, null);
this.domain = domain;
}
public void run() {
((OutgoingServerSession) getSession()).addAuthenticatedDomain(domain);
}
public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, domain);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
domain = ExternalizableUtil.getInstance().readSafeUTF(in);
}
}
private static class AddHostnameTask extends OutgoingServerSessionTask {
private String hostname;
public AddHostnameTask() { public AddOutgoingDomainPair() {
super(); super();
} }
protected AddHostnameTask(JID address, String hostname) { protected AddOutgoingDomainPair(JID address, String local, String remote) {
super(address, null); super(address, null);
this.hostname = hostname; this.local = local;
this.remote = remote;
} }
public void run() { public void run() {
((OutgoingServerSession) getSession()).addHostname(hostname); ((OutgoingServerSession) getSession()).addOutgoingDomainPair(local, remote);
} }
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
super.writeExternal(out); super.writeExternal(out);
ExternalizableUtil.getInstance().writeSafeUTF(out, hostname); ExternalizableUtil.getInstance().writeSafeUTF(out, local);
ExternalizableUtil.getInstance().writeSafeUTF(out, remote);
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in); super.readExternal(in);
hostname = ExternalizableUtil.getInstance().readSafeUTF(in); local = ExternalizableUtil.getInstance().readSafeUTF(in);
remote = ExternalizableUtil.getInstance().readSafeUTF(in);
} }
} }
......
...@@ -160,8 +160,7 @@ public abstract class RemoteSessionTask implements ClusterTask<Object> { ...@@ -160,8 +160,7 @@ public abstract class RemoteSessionTask implements ClusterTask<Object> {
/** /**
* Operations of outgoing server sessions * Operations of outgoing server sessions
*/ */
getAuthenticatedDomains, getOutgoingDomainPairs,
getHostnames,
isUsingServerDialback, isUsingServerDialback,
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment