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
<p><b>2.2.3</b> -- September 15, 2017</p>
<ul>
<li>Use an event rather than an arbitrary delay before starting clustering</li>
<li>Requires Openfire 4.2.0</li>
</ul>
<p><b>2.2.2</b> -- August 3, 2017</p>
......
......@@ -7,5 +7,5 @@
<author>Tom Evans</author>
<version>2.2.3</version>
<date>09/15/2017</date>
<minServerVersion>4.0.0</minServerVersion>
<minServerVersion>4.2.0</minServerVersion>
</plugin>
......@@ -8,7 +8,7 @@
</parent>
<groupId>org.igniterealtime.openfire.plugins</groupId>
<artifactId>hazelcast</artifactId>
<version>2.2.1</version>
<version>2.2.3</version>
<name>Hazelcast Plugin</name>
<description>Adds clustering support</description>
......@@ -35,4 +35,4 @@
</dependency>
</dependencies>
</project>
\ No newline at end of file
</project>
......@@ -49,11 +49,8 @@ public class OutgoingServerSessionTask extends RemoteSessionTask {
public void run() {
super.run();
if (operation == Operation.getAuthenticatedDomains) {
result = ((OutgoingServerSession) getSession()).getAuthenticatedDomains();
}
else if (operation == Operation.getHostnames) {
result = ((OutgoingServerSession) getSession()).getHostnames();
if (operation == Operation.getOutgoingDomainPairs) {
result = ((OutgoingServerSession) getSession()).getOutgoingDomainPairs();
}
else if (operation == Operation.isUsingServerDialback) {
result = ((OutgoingServerSession) getSession()).isUsingServerDialback();
......
......@@ -16,6 +16,7 @@
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.session.DomainPair;
import org.jivesoftware.openfire.session.OutgoingServerSession;
import org.jivesoftware.util.cache.ClusterTask;
import org.jivesoftware.util.cache.ExternalizableUtil;
......@@ -40,22 +41,15 @@ public class RemoteOutgoingServerSession extends RemoteSession implements Outgoi
super(nodeID, address);
}
public Collection<String> getAuthenticatedDomains() {
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getAuthenticatedDomains);
return (Collection<String>) doSynchronousClusterTask(task);
public Collection<DomainPair> getOutgoingDomainPairs()
{
ClusterTask task = getRemoteSessionTask(RemoteSessionTask.Operation.getOutgoingDomainPairs);
return (Collection<DomainPair>) doSynchronousClusterTask(task);
}
public void addAuthenticatedDomain(String domain) {
doClusterTask(new AddAuthenticatedDomainTask(address, domain));
}
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 void addOutgoingDomainPair( String local, String remote )
{
doClusterTask(new AddOutgoingDomainPair(address, local, remote ));
}
public boolean authenticateSubdomain(String domain, String hostname) {
......@@ -88,57 +82,34 @@ public class RemoteOutgoingServerSession extends RemoteSession implements Outgoi
return new ProcessPacketTask(this, address, packet);
}
private static class AddAuthenticatedDomainTask extends OutgoingServerSessionTask {
private String domain;
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;
private static class AddOutgoingDomainPair extends OutgoingServerSessionTask {
private String local;
private String remote;
public AddHostnameTask() {
public AddOutgoingDomainPair() {
super();
}
protected AddHostnameTask(JID address, String hostname) {
protected AddOutgoingDomainPair(JID address, String local, String remote) {
super(address, null);
this.hostname = hostname;
this.local = local;
this.remote = remote;
}
public void run() {
((OutgoingServerSession) getSession()).addHostname(hostname);
((OutgoingServerSession) getSession()).addOutgoingDomainPair(local, remote);
}
public void writeExternal(ObjectOutput out) throws IOException {
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 {
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> {
/**
* Operations of outgoing server sessions
*/
getAuthenticatedDomains,
getHostnames,
getOutgoingDomainPairs,
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