Commit d7b5cba3 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Code cleanup.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3815 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8d801e92
......@@ -12,6 +12,8 @@
<sourceFolder url="file://$MODULE_DIR$/src/plugins/registration/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/plugins/search/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/plugins/userImportExport/src/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/plugins/userservice/src/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/src/plugins/enterprise" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
......
......@@ -935,7 +935,6 @@
<target name="plugin" description="build one plugin">
<delete dir="${plugin.dev.dest.dir}/${plugin}"/>
<delete file="${plugin.dev.dest.dir}/${plugin}.jar"/>
<delete dir="${plugin.dest.dir}/${plugin}"/>
<delete file="${plugin.dest.dir}/${plugin}.jar"/>
<buildplugin plugin="${plugin}" pluginsrc="${plugin.src.dir}"/>
</target>
......
......@@ -43,7 +43,7 @@ import org.jivesoftware.wildfire.XMPPServer;
public interface Module {
/**
* <p>Obtain the name of the module for display in administration interfaces.</p>
* Returns the name of the module for display in administration interfaces.
*
* @return The name of the module.
*/
......
......@@ -78,7 +78,14 @@ public class PluginManager {
*/
public void start() {
executor = new ScheduledThreadPoolExecutor(1);
executor.scheduleWithFixedDelay(new PluginMonitor(), 0, 15, TimeUnit.SECONDS);
// See if we're in development mode. If so, check for new plugins once every 5 seconds.
// Otherwise, default to every 30 seconds.
if (Boolean.getBoolean("developmentMode")) {
executor.scheduleWithFixedDelay(new PluginMonitor(), 0, 5, TimeUnit.SECONDS);
}
else {
executor.scheduleWithFixedDelay(new PluginMonitor(), 0, 30, TimeUnit.SECONDS);
}
}
/**
......@@ -150,7 +157,7 @@ public class PluginManager {
return;
}
Log.debug("Loading plugin " + pluginDir.getName());
Plugin plugin = null;
Plugin plugin;
try {
File pluginConfig = new File(pluginDir, "plugin.xml");
if (pluginConfig.exists()) {
......@@ -339,8 +346,8 @@ public class PluginManager {
// Modify all the URL's in the XML so that they are passed through
// the plugin servlet correctly.
List urls = adminElement.selectNodes("//@url");
for (int i = 0; i < urls.size(); i++) {
Attribute attr = (Attribute)urls.get(i);
for (Object url : urls) {
Attribute attr = (Attribute) url;
attr.setValue("plugins/" + pluginName + "/" + attr.getValue());
}
AdminConsole.addModel(pluginName, adminElement);
......@@ -566,8 +573,7 @@ public class PluginManager {
return;
}
for (int i = 0; i < jars.length; i++) {
File jarFile = jars[i];
for (File jarFile : jars) {
String pluginName = jarFile.getName().substring(0,
jarFile.getName().length() - 4).toLowerCase();
// See if the JAR has already been exploded.
......@@ -651,8 +657,7 @@ public class PluginManager {
}
// Load all plugins that need to be loaded.
for (int i = 0; i < dirs.length; i++) {
File dirFile = dirs[i];
for (File dirFile : dirs) {
// If the plugin hasn't already been started, start it.
if (dirFile.exists() && !plugins.containsKey(dirFile.getName())) {
loadPlugin(dirFile);
......@@ -693,7 +698,7 @@ public class PluginManager {
FileOutputStream out = new FileOutputStream(entryFile);
InputStream zin = zipFile.getInputStream(entry);
byte[] b = new byte[512];
int len = 0;
int len;
while ((len = zin.read(b)) != -1) {
out.write(b, 0, len);
}
......@@ -703,7 +708,6 @@ public class PluginManager {
}
}
zipFile.close();
zipFile = null;
}
catch (Exception e) {
Log.error(e);
......@@ -716,8 +720,8 @@ public class PluginManager {
public boolean deleteDir(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
for (String file : children) {
boolean success = deleteDir(new File(dir, file));
if (!success) {
return false;
}
......
......@@ -37,15 +37,19 @@ public interface PacketInterceptor {
* the packet, or throw a PacketRejectedException to block it from being sent or processed
* (when read).<p>
*
* The exception can only be thrown when <tt>processed</tt> is false which means that the read
* An exception can only be thrown when <tt>processed</tt> is false which means that the read
* packet has not been processed yet or the packet was not sent yet. If the exception is thrown
* with a "read" packet then the sender of the packet will receive an answer with an error. But
* if the exception is thrown with a "sent" packet then nothing will happen.
* if the exception is thrown with a "sent" packet then nothing will happen.<p>
*
* @param packet the packet to take action on.
* @param session the session that received or is sending the packet.
* @param incoming flag that indicates if the packet was read by the server or sent from
* the server.
* Note that for each packet, every interceptor will be called twice: once before processing
* is complete (<tt>processing==true</tt>) and once after processing is complete. Typically,
* an interceptor will want to ignore one or the other case.
*
* @param packet the packet to take action on.
* @param session the session that received or is sending the packet.
* @param incoming flag that indicates if the packet was read by the server or sent from
* the server.
* @param processed flag that indicates if the action (read/send) was performed. (PRE vs. POST).
* @throws PacketRejectedException if the packet should be prevented from being processed.
*/
......
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