Commit c93cd454 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-22] Added ability to change subdomain of transports via 'advanced' property set.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5184 b35dd754-fafc-0310-a699-88a17e54d16e
parent 53760bb9
...@@ -34,6 +34,7 @@ public class TransportInstance implements PropertyEventListener { ...@@ -34,6 +34,7 @@ public class TransportInstance implements PropertyEventListener {
private TransportType type = null; private TransportType type = null;
private Boolean enabled = false; private Boolean enabled = false;
private Boolean running = false; private Boolean running = false;
private String subDomain;
/** /**
* Creates a new transport instance. * Creates a new transport instance.
...@@ -49,6 +50,7 @@ public class TransportInstance implements PropertyEventListener { ...@@ -49,6 +50,7 @@ public class TransportInstance implements PropertyEventListener {
this.nameOfClass = classname; this.nameOfClass = classname;
this.componentManager = componentManager; this.componentManager = componentManager;
enabled = JiveGlobals.getBooleanProperty("plugin.gateway."+this.type.toString()+".enabled", false); enabled = JiveGlobals.getBooleanProperty("plugin.gateway."+this.type.toString()+".enabled", false);
subDomain = JiveGlobals.getProperty("plugin.gateway."+this.type.toString()+".subdomain", this.type.toString());
} }
/** /**
...@@ -127,7 +129,7 @@ public class TransportInstance implements PropertyEventListener { ...@@ -127,7 +129,7 @@ public class TransportInstance implements PropertyEventListener {
} }
try { try {
componentManager.addComponent(this.type.toString(), transport); componentManager.addComponent(this.subDomain, transport);
PropertyEventDispatcher.addListener(this); PropertyEventDispatcher.addListener(this);
running = true; running = true;
} }
...@@ -146,7 +148,7 @@ public class TransportInstance implements PropertyEventListener { ...@@ -146,7 +148,7 @@ public class TransportInstance implements PropertyEventListener {
PropertyEventDispatcher.removeListener(this); PropertyEventDispatcher.removeListener(this);
try { try {
componentManager.removeComponent(this.type.toString()); componentManager.removeComponent(this.subDomain);
} }
catch (Exception e) { catch (Exception e) {
componentManager.getLog().error(e); componentManager.getLog().error(e);
...@@ -163,51 +165,59 @@ public class TransportInstance implements PropertyEventListener { ...@@ -163,51 +165,59 @@ public class TransportInstance implements PropertyEventListener {
} }
public void propertySet(String property, Map params) { public void propertySet(String property, Map params) {
if (property.equals("plugin.gateway."+this.type.toString()+".enabled")) { if (property.startsWith("plugin.gateway.")) {
enabled = Boolean.parseBoolean((String)params.get("value")); if (property.equals("plugin.gateway."+this.type.toString()+".enabled")) {
if (enabled) { enabled = Boolean.parseBoolean((String)params.get("value"));
if (!running) { if (enabled) {
startInstance(); if (!running) {
startInstance();
}
}
else {
if (running) {
stopInstance();
}
} }
} }
else { else if (property.equals("plugin.gateway."+this.type.toString()+".subdomain")) {
if (running) { String newSubDomain = (String)params.get("value");
stopInstance(); if (!newSubDomain.equals(this.subDomain)) {
if (running) {
stopInstance();
this.subDomain = newSubDomain;
startInstance();
}
} }
} }
} }
} }
public void propertyDeleted(String property, Map params) { public void propertyDeleted(String property, Map params) {
if (property.equals("plugin.gateway."+this.type.toString()+".enabled")) { if (property.startsWith("plugin.gateway.")) {
if (running) { if (property.equals("plugin.gateway."+this.type.toString()+".enabled")) {
stopInstance();
}
}
}
public void xmlPropertySet(String property, Map params) {
if (property.equals("plugin.gateway."+this.type.toString()+".enabled")) {
enabled = Boolean.parseBoolean((String)params.get("value"));
if (enabled) {
if (!running) {
startInstance();
}
}
else {
if (running) { if (running) {
stopInstance(); stopInstance();
} }
} }
else if (property.equals("plugin.gateway."+this.type.toString()+".subdomain")) {
String newSubDomain = this.type.toString();
if (!newSubDomain.equals(this.subDomain)) {
if (running) {
stopInstance();
this.subDomain = newSubDomain;
startInstance();
}
}
}
} }
} }
public void xmlPropertySet(String property, Map params) {
propertySet(property, params);
}
public void xmlPropertyDeleted(String property, Map params) { public void xmlPropertyDeleted(String property, Map params) {
if (property.equals("plugin.gateway."+this.type.toString()+".enabled")) { propertyDeleted(property, params);
if (running) {
stopInstance();
}
}
} }
} }
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