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

OF-546 / OF-1326: Made compatible with API changes.

The Openfire plugin developer guide states that 'additinal' files should be in /classes/. Apparently, the old Ant script also included any files in the /src/. The new Maven structure does not.
To work around compatibility issues, code that was in /src/ is now moved to /classes/. This should work with both Ant, as well as Maven.

Additionally, this plugin now makes use of the new HttpBindManager API for registering contexts with the BOSH context. I do wonder if this plugin has any reason to be here though. Can't it just run its own embedded Jetty server?
parent fc9b4693
...@@ -42,6 +42,13 @@ ...@@ -42,6 +42,13 @@
<h1> <h1>
</h1> </h1>
<p><b>0.0.6</b> -- May 8 2017</p>
<ul>
<li>[<a href='https://igniterealtime.org/issues/browse/OF-1326'></a>] - Made compatible with new HttpBind API in Openfire 4.2.0</li>
<li>Minimum server requirement: 4.2.0 Alpha</li>
</ul>
<p><b>0.0.5</b> -- June 20 2016</p> <p><b>0.0.5</b> -- June 20 2016</p>
<ul> <ul>
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<class>com.ifsoft.jmxweb.plugin.JmxWebPlugin</class> <class>com.ifsoft.jmxweb.plugin.JmxWebPlugin</class>
<name>JmxWeb Plugin</name> <name>JmxWeb Plugin</name>
<description>JmxWeb plugin is web based platform for managing and monitoring openfire via JMX.</description> <description>JmxWeb plugin is web based platform for managing and monitoring openfire via JMX.</description>
<version>0.0.5</version> <version>0.0.6</version>
<licenseType>Apache 2.0</licenseType> <licenseType>Apache 2.0</licenseType>
<date>06/20/2016</date> <date>05/08/2017</date>
<minServerVersion>4.0.1</minServerVersion> <minServerVersion>4.2.0 Alpha</minServerVersion>
<author>igniterealtime.org</author> <author>igniterealtime.org</author>
</plugin> </plugin>
\ No newline at end of file
...@@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory; ...@@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory;
import org.apache.jasper.servlet.JasperInitializer; import org.apache.jasper.servlet.JasperInitializer;
import org.eclipse.jetty.plus.annotation.ContainerInitializer; import org.eclipse.jetty.plus.annotation.ContainerInitializer;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.util.security.*; import org.eclipse.jetty.util.security.*;
import org.eclipse.jetty.security.*; import org.eclipse.jetty.security.*;
...@@ -71,9 +70,10 @@ public class JmxWebPlugin implements Plugin { ...@@ -71,9 +70,10 @@ public class JmxWebPlugin implements Plugin {
private final static String OBJECTNAME_DATABASEPOOL = NAMEBASE + "type=databasepool"; private final static String OBJECTNAME_DATABASEPOOL = NAMEBASE + "type=databasepool";
private DatabasePool database = null; private DatabasePool database = null;
private EmailScheduler emailScheduler = null; private EmailScheduler emailScheduler = null;
private WebAppContext context;
private WebAppContext context2;
public void initializePlugin(PluginManager manager, File pluginDirectory) {
public void initializePlugin(PluginManager manager, File pluginDirectory) {
Log.info( "["+ NAME + "] initialize " + NAME + " plugin resources"); Log.info( "["+ NAME + "] initialize " + NAME + " plugin resources");
try { try {
...@@ -118,12 +118,9 @@ public class JmxWebPlugin implements Plugin { ...@@ -118,12 +118,9 @@ public class JmxWebPlugin implements Plugin {
try { try {
ContextHandlerCollection contexts = HttpBindManager.getInstance().getContexts();
try { try {
Log.info( "["+ NAME + "] starting jolokia"); Log.info( "["+ NAME + "] starting jolokia");
WebAppContext context = new WebAppContext(contexts, pluginDirectory.getPath(), "/jolokia"); context = new WebAppContext(null, pluginDirectory.getPath(), "/jolokia");
final List<ContainerInitializer> initializers = new ArrayList<>(); final List<ContainerInitializer> initializers = new ArrayList<>();
initializers.add(new ContainerInitializer(new JasperInitializer(), null)); initializers.add(new ContainerInitializer(new JasperInitializer(), null));
context.setAttribute("org.eclipse.jetty.containerInitializers", initializers); context.setAttribute("org.eclipse.jetty.containerInitializers", initializers);
...@@ -131,7 +128,7 @@ public class JmxWebPlugin implements Plugin { ...@@ -131,7 +128,7 @@ public class JmxWebPlugin implements Plugin {
context.setWelcomeFiles(new String[]{"index.html"}); context.setWelcomeFiles(new String[]{"index.html"});
Log.info( "["+ NAME + "] starting hawtio"); Log.info( "["+ NAME + "] starting hawtio");
WebAppContext context2 = new WebAppContext(contexts, pluginDirectory.getPath() + "/hawtio", "/hawtio"); context2 = new WebAppContext(null, pluginDirectory.getPath() + "/classes/hawtio", "/hawtio");
final List<ContainerInitializer> initializers2 = new ArrayList<>(); final List<ContainerInitializer> initializers2 = new ArrayList<>();
initializers2.add(new ContainerInitializer(new JasperInitializer(), null)); initializers2.add(new ContainerInitializer(new JasperInitializer(), null));
context2.setAttribute("org.eclipse.jetty.containerInitializers", initializers2); context2.setAttribute("org.eclipse.jetty.containerInitializers", initializers2);
...@@ -146,7 +143,8 @@ public class JmxWebPlugin implements Plugin { ...@@ -146,7 +143,8 @@ public class JmxWebPlugin implements Plugin {
SecurityHandler securityHandler2 = basicAuth("jmxweb"); SecurityHandler securityHandler2 = basicAuth("jmxweb");
if (securityHandler2 != null) context2.setSecurityHandler(securityHandler2); if (securityHandler2 != null) context2.setSecurityHandler(securityHandler2);
} }
HttpBindManager.getInstance().addJettyHandler( context );
HttpBindManager.getInstance().addJettyHandler( context2 );
} }
catch(Exception e) { catch(Exception e) {
Log.error( "An error has occurred", e ); Log.error( "An error has occurred", e );
...@@ -193,6 +191,10 @@ public class JmxWebPlugin implements Plugin { ...@@ -193,6 +191,10 @@ public class JmxWebPlugin implements Plugin {
{ {
emailScheduler.stopMonitoring(); emailScheduler.stopMonitoring();
} }
HttpBindManager.getInstance().removeJettyHandler( context );
HttpBindManager.getInstance().removeJettyHandler( context2 );
Log.info("["+ NAME + "] plugin fully destroyed."); Log.info("["+ NAME + "] plugin fully destroyed.");
} }
......
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