Commit 49ef5efe authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

1) Adding new PluginDevelopmentEnvironemnt to specify development environment...

1) Adding new PluginDevelopmentEnvironemnt to specify development environment in your plugins.xml file.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1461 b35dd754-fafc-0310-a699-88a17e54d16e
parent 39243fd9
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.messenger.container;
import java.io.File;
/**
* Represents the data model used to represent development mode within the Jive
* Messenger plugin framework.
*
* @author Derek DeMoro
*/
public class PluginDevEnvironment {
private File webRoot;
private File classesDir;
/**
* Returns the document root of a plugins web development
* application.
* @return the document root of a plugin.
*/
public File getWebRoot() {
return webRoot;
}
/**
* Set the document root of a plugin.
* @param webRoot the document root of a plugin.
*/
public void setWebRoot(File webRoot) {
this.webRoot = webRoot;
}
/**
* Returns the classes directory of a plugin in development mode.
* @return the classes directory of a plugin in development mode.
*/
public File getClassesDir() {
return classesDir;
}
/**
* Sets the classes directory of a plugin used in development mode.
* @param classesDir the classes directory.
*/
public void setClassesDir(File classesDir) {
this.classesDir = classesDir;
}
}
......@@ -365,6 +365,13 @@ public class PluginServlet extends HttpServlet {
if (fileSeperator != -1) {
String pluginName = jspURL.substring(0 , fileSeperator);
Plugin plugin = pluginManager.getPlugin(pluginName);
PluginDevEnvironment environment = pluginManager.getDevEnvironment(plugin);
File webDir = environment.getWebRoot();
if(webDir == null || !webDir.exists()){
return false;
}
File pluginDirectory = pluginManager.getPluginDirectory(plugin);
File compilationDir = new File(pluginDirectory , "classes");
......@@ -379,7 +386,7 @@ public class PluginServlet extends HttpServlet {
relativeDir = relativeDir.replaceAll("//", ".") + '.';
}
File jspFile = new File(pluginDirectory + "/web" , jsp);
File jspFile = new File(webDir, jsp);
String filename = jspFile.getName();
int indexOfPeriod = filename.indexOf(".");
if (indexOfPeriod != -1) {
......@@ -390,7 +397,12 @@ public class PluginServlet extends HttpServlet {
if (!jspFile.exists()) {
return false;
}
jspc.setJspFiles(jspFile.getAbsolutePath());
try {
jspc.setJspFiles(jspFile.getCanonicalPath());
}
catch (IOException e) {
e.printStackTrace();
}
jspc.setOutputDir(compilationDir.getAbsolutePath());
jspc.setClassName(filename);
jspc.setCompile(true);
......
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