align to code conventions and minor java5 updates, also added more logging of exceptions
diff --git a/VERSION.txt b/VERSION.txt
index a4eb5a0..dafaafd 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1,3 +1,4 @@
1.0.0-SNAPSHOT
+ + Bug 331163 disabled Download and Install button
+ Bug 330525 address license display from html -> txt
+ Bug 329144 modify websocket template to generate WebSocket #onFragment
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/JettyPlugin.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/JettyPlugin.java
index 554a333..619307e 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/JettyPlugin.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/JettyPlugin.java
@@ -34,7 +34,7 @@
public static final String PLUGIN_ID = "org.eclipse.jst.server.jetty.core"; //$NON-NLS-1$
// The shared instance
- private static JettyPlugin plugin;
+ private static JettyPlugin _plugin;
/**
* The constructor
@@ -51,7 +51,7 @@
public void start(BundleContext context) throws Exception
{
super.start(context);
- plugin = this;
+ _plugin = this;
}
/*
@@ -61,7 +61,7 @@
*/
public void stop(BundleContext context) throws Exception
{
- plugin = null;
+ _plugin = null;
super.stop(context);
}
@@ -72,7 +72,7 @@
*/
public static JettyPlugin getDefault()
{
- return plugin;
+ return _plugin;
}
/**
@@ -153,17 +153,17 @@
public static IJettyVersionHandler getJettyVersionHandler(String id)
{
- return JettyVersionManager.INSTANCE.getJettyVersionHandler(id);
+ return JettyVersionManager.__INSTANCE.getJettyVersionHandler(id);
}
public static IJettyConfiguration getJettyConfiguration(String id, IFolder path)
{
- return JettyVersionManager.INSTANCE.getJettyConfiguration(id,path);
+ return JettyVersionManager.__INSTANCE.getJettyConfiguration(id,path);
}
public static Collection<String> getRuntimeTypes()
{
- return JettyVersionManager.INSTANCE.getRuntimeTypes();
+ return JettyVersionManager.__INSTANCE.getRuntimeTypes();
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/WebModule.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/WebModule.java
index eb6e031..a181509 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/WebModule.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/WebModule.java
@@ -18,10 +18,10 @@
*/
public class WebModule implements IJettyWebModule
{
- private String docBase;
- private String path;
- private String memento;
- private boolean reloadable;
+ private String _docBase;
+ private String _path;
+ private String _memento;
+ private boolean _reloadable;
/**
* WebModule constructor comment.
@@ -38,10 +38,10 @@
public WebModule(String path, String docBase, String memento, boolean reloadable)
{
super();
- this.path = path;
- this.docBase = docBase;
- this.memento = memento;
- this.reloadable = reloadable;
+ this._path = path;
+ this._docBase = docBase;
+ this._memento = memento;
+ this._reloadable = reloadable;
}
/**
@@ -51,7 +51,7 @@
*/
public String getDocumentBase()
{
- return docBase;
+ return _docBase;
}
/**
@@ -61,7 +61,7 @@
*/
public String getPath()
{
- return path;
+ return _path;
}
/**
@@ -71,7 +71,7 @@
*/
public String getMemento()
{
- return memento;
+ return _memento;
}
/**
@@ -81,7 +81,7 @@
*/
public boolean isReloadable()
{
- return reloadable;
+ return _reloadable;
}
public int hashCode()
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddModuleCommand.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddModuleCommand.java
index 4925b39..235cfa2 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddModuleCommand.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddModuleCommand.java
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.server.jetty.core.JettyPlugin;
import org.eclipse.jst.server.jetty.core.internal.Messages;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServerWorkingCopy;
@@ -26,9 +27,9 @@
*/
public class AddModuleCommand extends AbstractOperation
{
- protected IServerWorkingCopy server;
- protected IModule module;
- protected int modules = -1;
+ protected IServerWorkingCopy _server;
+ protected IModule _module;
+ protected int _moduleCount = -1;
/**
* AddModuleCommand constructor comment.
@@ -41,20 +42,19 @@
public AddModuleCommand(IServerWorkingCopy server, IModule module)
{
super(Messages.configurationEditorActionAddWebModule);
- this.server = server;
- this.module = module;
+ this._server = server;
+ this._module = module;
}
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
{
try
{
- server.modifyModules(new IModule[]
- { module },null,monitor);
+ _server.modifyModules(new IModule[]{ _module },null,monitor);
}
catch (Exception e)
{
- // ignore
+ JettyPlugin.log(e);
}
return Status.OK_STATUS;
}
@@ -68,12 +68,11 @@
{
try
{
- server.modifyModules(null,new IModule[]
- { module },monitor);
+ _server.modifyModules(null,new IModule[]{ _module },monitor);
}
catch (Exception e)
{
- // ignore
+ JettyPlugin.log(e);
}
return Status.OK_STATUS;
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddWebModuleCommand.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddWebModuleCommand.java
index 7840fa8..6e15993 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddWebModuleCommand.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/AddWebModuleCommand.java
@@ -20,8 +20,8 @@
*/
public class AddWebModuleCommand extends ConfigurationCommand
{
- protected WebModule module;
- protected int modules = -1;
+ protected WebModule _module;
+ protected int _moduleCount = -1;
/**
* AddWebModuleCommand constructor comment.
@@ -34,7 +34,7 @@
public AddWebModuleCommand(IJettyConfigurationWorkingCopy configuration, WebModule module)
{
super(configuration,Messages.configurationEditorActionAddWebModule);
- this.module = module;
+ this._module = module;
}
/**
@@ -42,8 +42,8 @@
*/
public void execute()
{
- modules = configuration.getWebModules().size();
- configuration.addWebModule(-1,module);
+ _moduleCount = getWorkingCopy().getWebModules().size();
+ getWorkingCopy().addWebModule(-1,_module);
}
/**
@@ -51,6 +51,6 @@
*/
public void undo()
{
- configuration.removeWebModule(modules);
+ getWorkingCopy().removeWebModule(_moduleCount);
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ConfigurationCommand.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ConfigurationCommand.java
index 39d32ca..6d918d3 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ConfigurationCommand.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ConfigurationCommand.java
@@ -23,7 +23,7 @@
*/
public abstract class ConfigurationCommand extends AbstractOperation
{
- protected IJettyConfigurationWorkingCopy configuration;
+ private IJettyConfigurationWorkingCopy _configuration;
/**
* ConfigurationCommand constructor comment.
@@ -36,7 +36,7 @@
public ConfigurationCommand(IJettyConfigurationWorkingCopy configuration, String label)
{
super(label);
- this.configuration = configuration;
+ this._configuration = configuration;
}
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
@@ -54,6 +54,11 @@
public abstract void undo();
+ public IJettyConfigurationWorkingCopy getWorkingCopy()
+ {
+ return _configuration;
+ }
+
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
{
undo();
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyPortCommand.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyPortCommand.java
index 436f6b5..f30dfb2 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyPortCommand.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyPortCommand.java
@@ -22,9 +22,9 @@
*/
public class ModifyPortCommand extends ConfigurationCommand
{
- protected String id;
- protected int port;
- protected int oldPort;
+ protected String _id;
+ protected int _port;
+ protected int _oldPort;
/**
* ModifyPortCommand constructor.
@@ -39,8 +39,8 @@
public ModifyPortCommand(IJettyConfigurationWorkingCopy configuration, String id, int port)
{
super(configuration,Messages.configurationEditorActionModifyPort);
- this.id = id;
- this.port = port;
+ this._id = id;
+ this._port = port;
}
/**
@@ -49,16 +49,19 @@
public void execute()
{
// find old port number
- Iterator iterator = configuration.getServerPorts().iterator();
+ Iterator<ServerPort> iterator = getWorkingCopy().getServerPorts().iterator();
while (iterator.hasNext())
{
- ServerPort temp = (ServerPort)iterator.next();
- if (id.equals(temp.getId()))
- oldPort = temp.getPort();
+ ServerPort temp = iterator.next();
+
+ if (_id.equals(temp.getId()))
+ {
+ _oldPort = temp.getPort();
+ }
}
// make the change
- configuration.modifyServerPort(id,port);
+ getWorkingCopy().modifyServerPort(_id,_port);
}
/**
@@ -66,6 +69,6 @@
*/
public void undo()
{
- configuration.modifyServerPort(id,oldPort);
+ getWorkingCopy().modifyServerPort(_id,_oldPort);
}
}
\ No newline at end of file
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyWebModuleCommand.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyWebModuleCommand.java
index 9f2136b..64adfa5 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyWebModuleCommand.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/ModifyWebModuleCommand.java
@@ -20,15 +20,15 @@
*/
public class ModifyWebModuleCommand extends ConfigurationCommand
{
- protected int index;
- protected WebModule oldModule;
- protected WebModule newModule;
+ protected int _index;
+ protected WebModule _oldModule;
+ protected WebModule _newModule;
public ModifyWebModuleCommand(IJettyConfigurationWorkingCopy configuration, int index, WebModule module)
{
super(configuration,Messages.configurationEditorActionModifyWebModule);
- this.index = index;
- newModule = module;
+ _index = index;
+ _newModule = module;
}
/**
@@ -36,8 +36,8 @@
*/
public void execute()
{
- oldModule = (WebModule)configuration.getWebModules().get(index);
- configuration.modifyWebModule(index,newModule.getDocumentBase(),newModule.getPath(),newModule.isReloadable());
+ _oldModule = getWorkingCopy().getWebModules().get(_index);
+ getWorkingCopy().modifyWebModule(_index,_newModule.getDocumentBase(),_newModule.getPath(),_newModule.isReloadable());
}
/**
@@ -45,6 +45,6 @@
*/
public void undo()
{
- configuration.modifyWebModule(index,oldModule.getDocumentBase(),oldModule.getPath(),oldModule.isReloadable());
+ getWorkingCopy().modifyWebModule(_index,_oldModule.getDocumentBase(),_oldModule.getPath(),_oldModule.isReloadable());
}
}
\ No newline at end of file
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveModuleCommand.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveModuleCommand.java
index 28d569b..cfe7e4a 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveModuleCommand.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveModuleCommand.java
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.server.jetty.core.JettyPlugin;
import org.eclipse.jst.server.jetty.core.internal.Messages;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServerWorkingCopy;
@@ -26,8 +27,8 @@
*/
public class RemoveModuleCommand extends AbstractOperation
{
- protected IServerWorkingCopy server;
- protected IModule module;
+ protected IServerWorkingCopy _server;
+ protected IModule _module;
/**
* AddModuleCommand constructor comment.
@@ -40,20 +41,19 @@
public RemoveModuleCommand(IServerWorkingCopy server, IModule module)
{
super(Messages.configurationEditorActionRemoveWebModule);
- this.server = server;
- this.module = module;
+ this._server = server;
+ this._module = module;
}
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
{
try
{
- server.modifyModules(null,new IModule[]
- { module },monitor);
+ _server.modifyModules(null,new IModule[]{ _module },monitor);
}
catch (Exception e)
{
- // ignore
+ JettyPlugin.log(e);
}
return Status.OK_STATUS;
}
@@ -67,13 +67,13 @@
{
try
{
- server.modifyModules(new IModule[]
- { module },null,monitor);
+ _server.modifyModules(new IModule[]{ _module },null,monitor);
}
catch (Exception e)
{
- // ignore
+ JettyPlugin.log(e);
}
+
return Status.OK_STATUS;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveWebModuleCommand.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveWebModuleCommand.java
index f394c21..a2faca2 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveWebModuleCommand.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/command/RemoveWebModuleCommand.java
@@ -20,8 +20,8 @@
*/
public class RemoveWebModuleCommand extends ConfigurationCommand
{
- protected int index;
- protected WebModule module;
+ protected int _index;
+ protected WebModule _module;
/**
* RemoveWebModuleCommand constructor comment.
@@ -34,7 +34,7 @@
public RemoveWebModuleCommand(IJettyConfigurationWorkingCopy configuration, int index)
{
super(configuration,Messages.configurationEditorActionRemoveWebModule);
- this.index = index;
+ this._index = index;
}
/**
@@ -42,8 +42,8 @@
*/
public void execute()
{
- module = (WebModule)configuration.getWebModules().get(index);
- configuration.removeWebModule(index);
+ _module = getWorkingCopy().getWebModules().get(_index);
+ getWorkingCopy().removeWebModule(_index);
}
/**
@@ -51,6 +51,6 @@
*/
public void undo()
{
- configuration.addWebModule(index,module);
+ getWorkingCopy().addWebModule(_index,_module);
}
}
\ No newline at end of file
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/FileUtil.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/FileUtil.java
index b881da5..f3cabd1 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/FileUtil.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/FileUtil.java
@@ -90,8 +90,7 @@
}
else if (current.isDirectory())
{
- monitor.subTask(NLS.bind(Messages.copyingTask,new String[]
- { fromFile, toFile }));
+ monitor.subTask(NLS.bind(Messages.copyingTask,new String[] { fromFile, toFile }));
copyDirectory(fromFile,toFile,ProgressUtil.getSubMonitorFor(monitor,50));
}
if (monitor.isCanceled())
@@ -145,7 +144,7 @@
}
catch (Exception ex)
{
- // ignore
+ JettyPlugin.log(ex);
}
try
{
@@ -154,7 +153,7 @@
}
catch (Exception ex)
{
- // ignore
+ JettyPlugin.log(ex);
}
}
}
@@ -309,8 +308,7 @@
}
else if (current.isDirectory())
{
- monitor.subTask(NLS.bind(Messages.copyingTask,new String[]
- { fromFile, toFile }));
+ monitor.subTask(NLS.bind(Messages.copyingTask,new String[] { fromFile, toFile }));
smartCopyDirectory(fromFile,toFile,ProgressUtil.getSubMonitorFor(monitor,dw));
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConfiguration.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConfiguration.java
index c173740..62a3673 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConfiguration.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConfiguration.java
@@ -39,7 +39,7 @@
public abstract class JettyConfiguration implements IJettyConfiguration, IJettyConfigurationWorkingCopy
{
- private IFolder configPath;
+ private IFolder _configPath;
/**
* JettyConfiguration constructor.
@@ -50,12 +50,12 @@
public JettyConfiguration(IFolder path)
{
super();
- this.configPath = path;
+ this._configPath = path;
}
protected IFolder getFolder()
{
- return configPath;
+ return _configPath;
}
/**
@@ -66,12 +66,16 @@
public ServerPort getMainPort()
{
Collection<ServerPort> serverPorts = getServerPorts();
+
for (ServerPort serverPort : serverPorts)
{
// Return only an HTTP port from the selected Service
if (serverPort.getProtocol().toLowerCase().equals("http") && serverPort.getId().indexOf('/') < 0)
+ {
return serverPort;
+ }
}
+
return null;
}
@@ -85,10 +89,14 @@
public String getWebModuleURL(IModule webModule)
{
WebModule module = getWebModule(webModule);
+
if (module != null)
+ {
return module.getPath();
+ }
IWebModule webModule2 = (IWebModule)webModule.loadAdapter(IWebModule.class,null);
+
return "/" + webModule2.getContextRoot();
}
@@ -102,7 +110,9 @@
public WebModule getWebModule(IModule module)
{
if (module == null)
+ {
return null;
+ }
String memento = module.getId();
@@ -144,8 +154,12 @@
public IStatus backupAndPublish(IPath jettyDir, boolean doBackup, IProgressMonitor monitor)
{
MultiStatus ms = new MultiStatus(JettyPlugin.PLUGIN_ID,0,Messages.publishConfigurationTask,null);
+
if (Trace.isTraceEnabled())
+ {
Trace.trace(Trace.FINER,"Backup and publish");
+ }
+
monitor = ProgressUtil.getMonitorFor(monitor);
try
@@ -163,8 +177,7 @@
catch (Exception e)
{
Trace.trace(Trace.SEVERE,"backupAndPublish() error",e);
- IStatus s = new Status(IStatus.ERROR,JettyPlugin.PLUGIN_ID,0,NLS.bind(Messages.errorPublishConfiguration,new String[]
- { e.getLocalizedMessage() }),e);
+ IStatus s = new Status(IStatus.ERROR,JettyPlugin.PLUGIN_ID,0,NLS.bind(Messages.errorPublishConfiguration,new String[]{ e.getLocalizedMessage() }),e);
ms.add(s);
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConstants.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConstants.java
index 4eaf97f..f255328 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConstants.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyConstants.java
@@ -12,12 +12,10 @@
public interface JettyConstants
{
-
- String START_JAR = "start.jar";
- String START_INI = "start.ini";
- String LIB_FOLDER = "lib";
- String JSP_FOLDER = "jsp";
- String JAR_EXT = "jar";
-
- String HTTP = "http";
+ public static final String __START_JAR = "start.jar";
+ public static final String __START_INI = "start.ini";
+ public static final String __LIB_FOLDER = "lib";
+ public static final String __JSP_FOLDER = "jsp";
+ public static final String __JAR_EXT = "jar";
+ public static final String __HTTP = "http";
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyHandler.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyHandler.java
index 7781f1e..9236604 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyHandler.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyHandler.java
@@ -24,14 +24,14 @@
{
/** configuration attribute for the full class name of the bootstrap class. */
- private static final String BOOTSTRAP_CLASS_NAME = "org.eclipse.jetty.start.Main";
+ private static final String __BOOTSTRAP_CLASS_NAME = "org.eclipse.jetty.start.Main";
/**
* @see IJettyVersionHandler#getRuntimeClass()
*/
public String getRuntimeClass()
{
- return BOOTSTRAP_CLASS_NAME;
+ return __BOOTSTRAP_CLASS_NAME;
}
public Collection<IRuntimeClasspathEntry> getRuntimeClasspath(IPath installPath, IPath configPath)
@@ -39,11 +39,11 @@
Collection<IRuntimeClasspathEntry> cp = new ArrayList<IRuntimeClasspathEntry>();
// Add ${jetty.home}/start.jar
- IPath startJAR = installPath.append(START_JAR);
+ IPath startJAR = installPath.append(__START_JAR);
cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(startJAR));
// add all jars from the Jetty ${jetty.home}/lib directory
- IPath libPath = installPath.append(LIB_FOLDER);
+ IPath libPath = installPath.append(__LIB_FOLDER);
File libDir = libPath.toFile();
if (libDir.exists())
{
@@ -51,22 +51,22 @@
String[] libs = libDir.list();
for (int i = 0; i < libs.length; i++)
{
- if (libs[i].endsWith(JAR_EXT))
+ if (libs[i].endsWith(__JAR_EXT))
{
- IPath path = installPath.append(LIB_FOLDER).append(libs[i]);
+ IPath path = installPath.append(__LIB_FOLDER).append(libs[i]);
cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
}
}
// add all jars from the Jetty ${jetty.home}/lib/jsp directory
- IPath jspLibPath = libPath.append(JSP_FOLDER);
+ IPath jspLibPath = libPath.append(__JSP_FOLDER);
File jspLibDir = jspLibPath.toFile();
if (jspLibDir.exists())
{
libs = jspLibDir.list();
for (int i = 0; i < libs.length; i++)
{
- if (libs[i].endsWith(JAR_EXT))
+ if (libs[i].endsWith(__JAR_EXT))
{
IPath path = jspLibPath.append(libs[i]);
cp.add(JavaRuntime.newArchiveRuntimeClasspathEntry(path));
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchConfigurationDelegate.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchConfigurationDelegate.java
index 351a1f8..88e6d97 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchConfigurationDelegate.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchConfigurationDelegate.java
@@ -25,6 +25,7 @@
import org.eclipse.jdt.launching.IVMRunner;
import org.eclipse.jdt.launching.VMRunnerConfiguration;
import org.eclipse.jst.server.core.ServerProfilerDelegate;
+import org.eclipse.jst.server.jetty.core.JettyPlugin;
import org.eclipse.jst.server.jetty.core.internal.JettyServerBehaviour;
import org.eclipse.jst.server.jetty.core.internal.Trace;
import org.eclipse.wst.server.core.IServer;
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchableAdapterDelegate.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchableAdapterDelegate.java
index a0e423f..3e6fc1a 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchableAdapterDelegate.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyLaunchableAdapterDelegate.java
@@ -15,6 +15,7 @@
import org.eclipse.jst.server.core.IWebModule;
import org.eclipse.jst.server.core.Servlet;
+import org.eclipse.jst.server.jetty.core.JettyPlugin;
import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IURLProvider;
@@ -28,7 +29,7 @@
public class JettyLaunchableAdapterDelegate extends LaunchableAdapterDelegate
{
- private static final String SERVLET_PATH = "servlet/";
+ private static final String __SERVLET_PATH = "servlet/";
/*
* @see LaunchableAdapterDelegate#getLaunchable(IServer, IModuleArtifact)
@@ -36,12 +37,21 @@
public Object getLaunchable(IServer server, IModuleArtifact moduleObject)
{
Trace.trace(Trace.FINER,"JettyLaunchableAdapter " + server + "-" + moduleObject);
+
if (server.getAdapter(JettyServer.class) == null)
+ {
return null;
+ }
+
if (!(moduleObject instanceof Servlet) && !(moduleObject instanceof WebResource))
+ {
return null;
+ }
+
if (moduleObject.getModule().loadAdapter(IWebModule.class,null) == null)
+ {
return null;
+ }
try
{
@@ -60,7 +70,7 @@
url = new URL(url,path);
}
else
- url = new URL(url,SERVLET_PATH + servlet.getServletClassName());
+ url = new URL(url,__SERVLET_PATH + servlet.getServletClassName());
}
else if (moduleObject instanceof WebResource)
{
@@ -77,7 +87,9 @@
catch (Exception e)
{
Trace.trace(Trace.SEVERE,"Error getting URL for " + moduleObject,e);
- return null;
+ JettyPlugin.log(e);
}
+
+ return null;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntime.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntime.java
index 3dde6dd..19ba443 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntime.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntime.java
@@ -47,17 +47,19 @@
{
// private static final String TOOLS_JAR_PATH = "lib" + File.separator + "tools.jar";
- private static final String JAVAC_MAIN = "com.sun.tools.javac.Main";
- private static final String CLASS_DETECTOR = "org.eclipse.jst.server.Jetty.core.internal.ClassDetector";
+ private static final String __JAVAC_MAIN = "com.sun.tools.javac.Main";
+ private static final String __CLASS_DETECTOR = "org.eclipse.jst.server.jetty.core.internal.ClassDetector";
- protected static final String PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id";
- protected static final String PROP_VM_INSTALL_ID = "vm-install-id";
+ protected static final String __PROP_VM_INSTALL_TYPE_ID = "vm-install-type-id";
+ protected static final String __PROP_VM_INSTALL_ID = "vm-install-id";
- protected final static Map<File, Boolean> sdkMap = new HashMap<File, Boolean>(2);
- private static Map<String, Integer> javaVersionMap = new ConcurrentHashMap<String, Integer>();
+ protected final static Map<File, Boolean> __SDK_MAP = new HashMap<File, Boolean>(2);
+
+ private static Map<String, Integer> __JAVA_VERSION_MAP = new ConcurrentHashMap<String, Integer>();
public JettyRuntime()
{
+ super(); // possible error
// do nothing
}
@@ -69,12 +71,12 @@
protected String getVMInstallTypeId()
{
- return getAttribute(PROP_VM_INSTALL_TYPE_ID,(String)null);
+ return getAttribute(__PROP_VM_INSTALL_TYPE_ID,(String)null);
}
protected String getVMInstallId()
{
- return getAttribute(PROP_VM_INSTALL_ID,(String)null);
+ return getAttribute(__PROP_VM_INSTALL_ID,(String)null);
}
public boolean isUsingDefaultJRE()
@@ -100,8 +102,9 @@
}
catch (Exception e)
{
- // ignore
+ JettyPlugin.log(e);
}
+
return null;
}
@@ -119,7 +122,7 @@
}
catch (IOException e)
{
- // Ignore if there is a problem
+ JettyPlugin.log(e);
}
}
return getVersionHandler().getRuntimeClasspath(installPath,configPath);
@@ -165,6 +168,7 @@
// }
status = getVersionHandler().validate(getRuntime().getLocation(),getVMInstall());
+
if (status != null)
{
return status;
@@ -245,20 +249,30 @@
setVMInstall(null,null);
}
else
+ {
setVMInstall(vmInstall.getVMInstallType().getId(),vmInstall.getId());
+ }
}
protected void setVMInstall(String typeId, String id)
{
if (typeId == null)
- setAttribute(PROP_VM_INSTALL_TYPE_ID,(String)null);
+ {
+ setAttribute(__PROP_VM_INSTALL_TYPE_ID,(String)null);
+ }
else
- setAttribute(PROP_VM_INSTALL_TYPE_ID,typeId);
+ {
+ setAttribute(__PROP_VM_INSTALL_TYPE_ID,typeId);
+ }
if (id == null)
- setAttribute(PROP_VM_INSTALL_ID,(String)null);
+ {
+ setAttribute(__PROP_VM_INSTALL_ID,(String)null);
+ }
else
- setAttribute(PROP_VM_INSTALL_ID,id);
+ {
+ setAttribute(__PROP_VM_INSTALL_ID,id);
+ }
}
/**
@@ -272,9 +286,10 @@
{
// first try the cache
File javaHome = getVMInstall().getInstallLocation();
+
try
{
- Boolean b = (Boolean)sdkMap.get(javaHome);
+ Boolean b = (Boolean)__SDK_MAP.get(javaHome);
return b.booleanValue();
}
catch (Exception e)
@@ -287,10 +302,10 @@
if (file != null && file.exists())
{
IVMRunner vmRunner = getVMInstall().getVMRunner(ILaunchManager.RUN_MODE);
- VMRunnerConfiguration config = new VMRunnerConfiguration(CLASS_DETECTOR,new String[]
+ VMRunnerConfiguration config = new VMRunnerConfiguration(__CLASS_DETECTOR,new String[]
{ file.getAbsolutePath() });
config.setProgramArguments(new String[]
- { JAVAC_MAIN });
+ { __JAVAC_MAIN });
ILaunch launch = new Launch(null,ILaunchManager.RUN_MODE,null);
try
{
@@ -323,7 +338,7 @@
if (StringUtils.isTrue(text))
found = true;
- sdkMap.put(javaHome,Boolean.valueOf(found));
+ __SDK_MAP.put(javaHome,Boolean.valueOf(found));
return found;
}
}
@@ -355,7 +370,7 @@
private boolean isVMMinimumVersion(String javaVersion, int minimumVersion)
{
- Integer version = (Integer)javaVersionMap.get(javaVersion);
+ Integer version = (Integer)__JAVA_VERSION_MAP.get(javaVersion);
if (version == null)
{
int index = javaVersion.indexOf('.');
@@ -370,7 +385,7 @@
{
int minor = Integer.parseInt(javaVersion.substring(index,index2));
version = Integer.valueOf(major + minor);
- javaVersionMap.put(javaVersion,version);
+ __JAVA_VERSION_MAP.put(javaVersion,version);
}
}
catch (NumberFormatException e)
@@ -386,5 +401,4 @@
}
return true;
}
-
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeClasspathProvider.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeClasspathProvider.java
index 76d979c..b773401 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeClasspathProvider.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeClasspathProvider.java
@@ -35,14 +35,14 @@
// TODO : switch Jetty version, is there different classpath?
List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
- IPath libPath = installPath.append(LIB_FOLDER);
+ IPath libPath = installPath.append(__LIB_FOLDER);
File libDir = libPath.toFile();
if (libDir.exists())
{
// add all jars from the Jetty ${jetty.home}/lib
RuntimeClasspathProviderDelegate.addLibraryEntries(entries,libDir,true);
// add all jars from the Jetty ${jetty.home}/lib/jsp directory
- IPath jspLibPath = libPath.append(JSP_FOLDER);
+ IPath jspLibPath = libPath.append(__JSP_FOLDER);
File jspLibDir = jspLibPath.toFile();
if (jspLibDir.exists())
{
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeLocator.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeLocator.java
index 47b1ffc..a24ca1c 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeLocator.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyRuntimeLocator.java
@@ -129,6 +129,7 @@
catch (Exception e)
{
Trace.trace(Trace.SEVERE,"Could not find runtime",e);
+ JettyPlugin.log(e);
}
}
return null;
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServer.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServer.java
index 9fd9dd9..2e4516e 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServer.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServer.java
@@ -42,15 +42,15 @@
public class JettyServer extends ServerDelegate implements IJettyServer, IJettyServerWorkingCopy
{
- private static final ServerPort[] EMPTY_SERVER_PORTS = new ServerPort[0];
- public static final String PROPERTY_SECURE = "secure";
- public static final String PROPERTY_DEBUG = "debug";
+ private static final ServerPort[] _EMPTY_SERVER_PORTS = new ServerPort[0];
+ public static final String __PROPERTY_SECURE = "secure";
+ public static final String __PROPERTY_DEBUG = "debug";
- private static final String JST_WEB_MODULETYPE = "jst.web";
+ private static final String __JST_WEB_MODULETYPE = "jst.web";
- private static final IModule[] EMPTY_MODULES = new IModule[0];
- protected transient IJettyConfiguration configuration;
- protected transient IJettyVersionHandler versionHandler;
+ private static final IModule[] __EMPTY_MODULES = new IModule[0];
+ protected transient IJettyConfiguration _configuration;
+ protected transient IJettyVersionHandler _versionHandler;
/**
* JettyServer.
@@ -68,7 +68,9 @@
public JettyRuntime getJettyRuntime()
{
if (getServer().getRuntime() == null)
+ {
return null;
+ }
return (JettyRuntime)getServer().getRuntime().loadAdapter(JettyRuntime.class,null);
}
@@ -80,19 +82,21 @@
*/
public IJettyVersionHandler getJettyVersionHandler()
{
- if (versionHandler == null)
+ if (_versionHandler == null)
{
if (getServer().getRuntime() == null || getJettyRuntime() == null)
+ {
return null;
+ }
- versionHandler = getJettyRuntime().getVersionHandler();
+ _versionHandler = getJettyRuntime().getVersionHandler();
}
- return versionHandler;
+ return _versionHandler;
}
public IJettyConfiguration getJettyConfiguration() throws CoreException
{
- if (configuration == null)
+ if (_configuration == null)
{
IFolder folder = getServer().getServerConfiguration();
if (folder == null || !folder.exists())
@@ -110,25 +114,25 @@
}
String id = getServer().getServerType().getId();
- configuration = JettyPlugin.getJettyConfiguration(id,folder);
+ _configuration = JettyPlugin.getJettyConfiguration(id,folder);
try
{
- configuration.load(folder,getRuntimeBaseDirectory(),null);
+ _configuration.load(folder,getRuntimeBaseDirectory(),null);
}
catch (CoreException ce)
{
// ignore
- configuration = null;
+ _configuration = null;
throw ce;
}
}
- return configuration;
+ return _configuration;
}
@Override
public void configurationChanged()
{
- configuration = null;
+ _configuration = null;
}
@Override
@@ -136,22 +140,22 @@
{
if (runtime == null)
{
- configuration = null;
+ _configuration = null;
return;
}
IPath path = runtime.getLocation();
String id = getServer().getServerType().getId();
IPath runtimeBaseDirectory = getRuntimeBaseDirectory();
IFolder folder = getServer().getServerConfiguration();
- configuration = JettyPlugin.getJettyConfiguration(id,folder);
+ _configuration = JettyPlugin.getJettyConfiguration(id,folder);
try
{
- configuration.importFromPath(path,runtimeBaseDirectory,isTestEnvironment(),monitor);
+ _configuration.importFromPath(path,runtimeBaseDirectory,isTestEnvironment(),monitor);
}
catch (CoreException ce)
{
// ignore
- configuration = null;
+ _configuration = null;
throw ce;
}
}
@@ -159,16 +163,16 @@
@Override
public void saveConfiguration(IProgressMonitor monitor) throws CoreException
{
- if (configuration == null)
+ if (_configuration == null)
return;
- configuration.save(getServer().getServerConfiguration(),monitor);
+ _configuration.save(getServer().getServerConfiguration(),monitor);
}
@Override
public ServerPort[] getServerPorts()
{
if (getServer().getServerConfiguration() == null)
- return EMPTY_SERVER_PORTS;
+ return _EMPTY_SERVER_PORTS;
try
{
@@ -179,7 +183,7 @@
}
catch (Exception e)
{
- return EMPTY_SERVER_PORTS;
+ return _EMPTY_SERVER_PORTS;
}
}
@@ -200,7 +204,7 @@
*/
public void setDebug(boolean b)
{
- setAttribute(PROPERTY_DEBUG,b);
+ setAttribute(__PROPERTY_DEBUG,b);
}
/**
@@ -211,7 +215,7 @@
*/
public void setSecure(boolean b)
{
- setAttribute(PROPERTY_SECURE,b);
+ setAttribute(__PROPERTY_SECURE,b);
}
/**
@@ -297,7 +301,7 @@
for (int i = 0; i < size; i++)
{
IModule module = add[i];
- if (!JST_WEB_MODULETYPE.equals(module.getModuleType().getId()))
+ if (!__JST_WEB_MODULETYPE.equals(module.getModuleType().getId()))
return new Status(IStatus.ERROR,JettyPlugin.PLUGIN_ID,0,Messages.errorWebModulesOnly,null);
if (getJettyVersionHandler() == null)
@@ -382,7 +386,7 @@
IModuleType moduleType = module[0].getModuleType();
- if (module.length == 1 && moduleType != null && JST_WEB_MODULETYPE.equals(moduleType.getId()))
+ if (module.length == 1 && moduleType != null && __JST_WEB_MODULETYPE.equals(moduleType.getId()))
{
IWebModule webModule = (IWebModule)module[0].loadAdapter(IWebModule.class,null);
if (webModule != null)
@@ -393,7 +397,7 @@
return modules;
}
}
- return EMPTY_MODULES;
+ return __EMPTY_MODULES;
}
/**
@@ -407,7 +411,7 @@
@Override
public IModule[] getRootModules(IModule module) throws CoreException
{
- if (JST_WEB_MODULETYPE.equals(module.getModuleType().getId()))
+ if (__JST_WEB_MODULETYPE.equals(module.getModuleType().getId()))
{
IStatus status = canModifyModules(new IModule[]
{ module },null);
@@ -466,7 +470,7 @@
*/
public boolean isDebug()
{
- return getAttribute(PROPERTY_DEBUG,false);
+ return getAttribute(__PROPERTY_DEBUG,false);
}
/**
@@ -486,7 +490,7 @@
*/
public boolean isSecure()
{
- return getAttribute(PROPERTY_SECURE,false);
+ return getAttribute(__PROPERTY_SECURE,false);
}
public String getInstanceDirectory()
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerBehaviour.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerBehaviour.java
index d05867f..4c8ff4d 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerBehaviour.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerBehaviour.java
@@ -64,15 +64,17 @@
public class JettyServerBehaviour extends ServerBehaviourDelegate implements IJettyServerBehaviour, IModulePublishHelper
{
- private static final String ATTR_STOP = "stop-server";
+ private static final String __ATTR_STOP = "stop-server";
- private static final String[] JMX_EXCLUDE_ARGS = new String[]
- { "-Dcom.sun.management.jmxremote", "-Dcom.sun.management.jmxremote.port=", "-Dcom.sun.management.jmxremote.ssl=",
- "-Dcom.sun.management.jmxremote.authenticate=" };
+ private static final String[] __JMX_EXCLUDE_ARGS = new String[]{
+ "-Dcom.sun.management.jmxremote",
+ "-Dcom.sun.management.jmxremote.port=",
+ "-Dcom.sun.management.jmxremote.ssl=",
+ "-Dcom.sun.management.jmxremote.authenticate=" };
// the thread used to ping the server to check for startup
- protected transient PingThread ping = null;
- protected transient IDebugEventSetListener processListener;
+ protected transient PingThread _ping = null;
+ protected transient IDebugEventSetListener _processListener;
/**
* JettyServerBehaviour.
@@ -90,7 +92,9 @@
public JettyRuntime getJettyRuntime()
{
if (getServer().getRuntime() == null)
+ {
return null;
+ }
return (JettyRuntime)getServer().getRuntime().loadAdapter(JettyRuntime.class,null);
}
@@ -211,13 +215,18 @@
protected static String renderCommandLine(String[] commandLine, String separator)
{
if (commandLine == null || commandLine.length < 1)
+ {
return "";
+ }
+
StringBuffer buf = new StringBuffer(commandLine[0]);
+
for (int i = 1; i < commandLine.length; i++)
{
buf.append(separator);
buf.append(commandLine[i]);
}
+
return buf.toString();
}
@@ -235,14 +244,19 @@
*/
public void setupLaunch(ILaunch launch, String launchMode, IProgressMonitor monitor) throws CoreException
{
- if (StringUtils.isTrue(launch.getLaunchConfiguration().getAttribute(ATTR_STOP,StringUtils.FALSE)))
+ if (StringUtils.isTrue(launch.getLaunchConfiguration().getAttribute(__ATTR_STOP,StringUtils.FALSE)))
+ {
return;
+ }
// if (getJettyRuntime() == null)
// throw new CoreException();
IStatus status = getJettyRuntime().validate();
+
if (status != null && status.getSeverity() == IStatus.ERROR)
+ {
throw new CoreException(status);
+ }
// setRestartNeeded(false);
IJettyConfiguration configuration = getJettyConfiguration();
@@ -308,7 +322,7 @@
int port = configuration.getMainPort().getPort();
if (port != 80)
url += ":" + port;
- ping = new PingThread(getServer(),url,-1,this);
+ _ping = new PingThread(getServer(),url,-1,this);
}
catch (Exception e)
{
@@ -353,13 +367,13 @@
String args = renderCommandLine(getRuntimeProgramArguments(false)," ");
// Remove JMX arguments if present
String existingVMArgs = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,(String)null);
- if (existingVMArgs.indexOf(JMX_EXCLUDE_ARGS[0]) >= 0)
+ if (existingVMArgs.indexOf(__JMX_EXCLUDE_ARGS[0]) >= 0)
{
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,mergeArguments(existingVMArgs,new String[] {},JMX_EXCLUDE_ARGS,false));
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,mergeArguments(existingVMArgs,new String[] {},__JMX_EXCLUDE_ARGS,false));
}
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,args);
wc.setAttribute("org.eclipse.debug.ui.private",true);
- wc.setAttribute(ATTR_STOP,"true");
+ wc.setAttribute(__ATTR_STOP,"true");
wc.launch(ILaunchManager.RUN_MODE,new NullProgressMonitor());
}
catch (Exception e)
@@ -599,12 +613,14 @@
* @param cp
* @param entry
*/
- public static void replaceJREContainer(List cp, IRuntimeClasspathEntry entry)
+ public static void replaceJREContainer(List<IRuntimeClasspathEntry> cp, IRuntimeClasspathEntry entry)
{
int size = cp.size();
+
for (int i = 0; i < size; i++)
{
- IRuntimeClasspathEntry entry2 = (IRuntimeClasspathEntry)cp.get(i);
+ IRuntimeClasspathEntry entry2 = cp.get(i);
+
if (entry2.getPath().uptoSegment(2).isPrefixOf(entry.getPath()))
{
cp.set(i,entry);
@@ -621,12 +637,12 @@
* @param cp
* @param entry
*/
- public static void mergeClasspath(List cp, IRuntimeClasspathEntry entry)
+ public static void mergeClasspath(List<IRuntimeClasspathEntry> cp, IRuntimeClasspathEntry entry)
{
- Iterator iterator = cp.iterator();
+ Iterator<IRuntimeClasspathEntry> iterator = cp.iterator();
while (iterator.hasNext())
{
- IRuntimeClasspathEntry entry2 = (IRuntimeClasspathEntry)iterator.next();
+ IRuntimeClasspathEntry entry2 = iterator.next();
if (entry2.getPath().equals(entry.getPath()))
return;
@@ -708,17 +724,23 @@
IJettyRuntime runtime = getJettyRuntime();
IVMInstall vmInstall = runtime.getVMInstall();
if (vmInstall != null)
+ {
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH,JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
+ }
// update classpath
IRuntimeClasspathEntry[] originalClasspath = JavaRuntime.computeUnresolvedRuntimeClasspath(workingCopy);
int size = originalClasspath.length;
List<IRuntimeClasspathEntry> oldCp = new ArrayList<IRuntimeClasspathEntry>(originalClasspath.length + 2);
+
for (int i = 0; i < size; i++)
+ {
oldCp.add(originalClasspath[i]);
+ }
Collection<IRuntimeClasspathEntry> cp2 = runtime.getRuntimeClasspath(getRuntimeBaseDirectory());
Iterator<IRuntimeClasspathEntry> iterator = cp2.iterator();
+
while (iterator.hasNext())
{
IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry)iterator.next();
@@ -730,12 +752,14 @@
try
{
String typeId = vmInstall.getVMInstallType().getId();
+
replaceJREContainer(oldCp,JavaRuntime.newRuntimeContainerClasspathEntry(
new Path(JavaRuntime.JRE_CONTAINER).append(typeId).append(vmInstall.getName()),IRuntimeClasspathEntry.BOOTSTRAP_CLASSES));
+
}
catch (Exception e)
{
- // ignore
+ JettyPlugin.log(e);
}
IPath jrePath = new Path(vmInstall.getInstallLocation().getAbsolutePath());
@@ -747,6 +771,7 @@
IRuntimeClasspathEntry toolsJar = JavaRuntime.newArchiveRuntimeClasspathEntry(toolsPath);
// Search for index to any existing tools.jar entry
int toolsIndex;
+
for (toolsIndex = 0; toolsIndex < oldCp.size(); toolsIndex++)
{
IRuntimeClasspathEntry entry = (IRuntimeClasspathEntry)oldCp.get(toolsIndex);
@@ -758,15 +783,20 @@
// If existing tools.jar found, replace in case it's
// different. Otherwise add.
if (toolsIndex < oldCp.size())
+ {
oldCp.set(toolsIndex,toolsJar);
+ }
else
+ {
mergeClasspath(oldCp,toolsJar);
+ }
}
}
}
iterator = oldCp.iterator();
List<String> list = new ArrayList<String>();
+
while (iterator.hasNext())
{
IRuntimeClasspathEntry entry = iterator.next();
@@ -786,10 +816,10 @@
protected void addProcessListener(final IProcess newProcess)
{
- if (processListener != null || newProcess == null)
+ if (_processListener != null || newProcess == null)
return;
- processListener = new IDebugEventSetListener()
+ _processListener = new IDebugEventSetListener()
{
public void handleDebugEvents(DebugEvent[] events)
{
@@ -806,7 +836,8 @@
}
}
};
- DebugPlugin.getDefault().addDebugEventListener(processListener);
+
+ DebugPlugin.getDefault().addDebugEventListener(_processListener);
}
protected void setServerStarted()
@@ -816,15 +847,15 @@
protected void stopImpl()
{
- if (ping != null)
+ if (_ping != null)
{
- ping.stop();
- ping = null;
+ _ping.stop();
+ _ping = null;
}
- if (processListener != null)
+ if (_processListener != null)
{
- DebugPlugin.getDefault().removeDebugEventListener(processListener);
- processListener = null;
+ DebugPlugin.getDefault().removeDebugEventListener(_processListener);
+ _processListener = null;
}
setServerState(IServer.STATE_STOPPED);
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerLocator.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerLocator.java
index 0557398..5f9d771 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerLocator.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyServerLocator.java
@@ -43,6 +43,7 @@
}
}
};
+
JettyRuntimeLocator.searchForRuntimes2(null,listener2,monitor);
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyVersionManager.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyVersionManager.java
index f6d58ed..680a4ce 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyVersionManager.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/JettyVersionManager.java
@@ -26,11 +26,11 @@
public class JettyVersionManager
{
- public static final JettyVersionManager INSTANCE = new JettyVersionManager();
+ public static final JettyVersionManager __INSTANCE = new JettyVersionManager();
- private Map<String, IJettyVersionProvider> versionProviders = new HashMap<String, IJettyVersionProvider>();
+ private Map<String, IJettyVersionProvider> _versionProviders = new HashMap<String, IJettyVersionProvider>();
- private List<String> runtimeTypes = new ArrayList<String>();
+ private List<String> _runtimeTypes = new ArrayList<String>();
public enum JettyVersion
{
@@ -40,25 +40,26 @@
private JettyVersionManager()
{
// Jetty 7.1
- register(JettyVersion.V71,Jetty7Provider.INSTANCE);
+ register(JettyVersion.V71, Jetty7Provider.__INSTANCE);
// Jetty 7.2
- register(JettyVersion.V72,Jetty7Provider.INSTANCE);
+ register(JettyVersion.V72, Jetty7Provider.__INSTANCE);
// Jetty 8.0, same than Jetty7.0
- register(JettyVersion.V80,Jetty8Provider.INSTANCE);
+ register(JettyVersion.V80, Jetty8Provider.__INSTANCE);
}
public void register(JettyVersion version, IJettyVersionProvider versionProvider)
{
- versionProviders.put(version.name(),versionProvider);
+ _versionProviders.put(version.name(),versionProvider);
String versionNumber = version.name().substring(1,version.name().length());
- runtimeTypes.add("org.eclipse.jst.server.jetty.runtime." + versionNumber);
+
+ _runtimeTypes.add("org.eclipse.jst.server.jetty.runtime." + versionNumber);
}
public IJettyVersionHandler getJettyVersionHandler(String id)
{
String version = getVersion(id);
- IJettyVersionProvider versionProvider = versionProviders.get(version);
+ IJettyVersionProvider versionProvider = _versionProviders.get(version);
if (versionProvider == null)
{
throw new JettyVersionHandlerNotFoundException(version);
@@ -69,7 +70,7 @@
public IJettyConfiguration getJettyConfiguration(String id, IFolder path)
{
String version = getVersion(id);
- IJettyVersionProvider versionProvider = versionProviders.get(version);
+ IJettyVersionProvider versionProvider = _versionProviders.get(version);
if (versionProvider == null)
{
throw new JettyVersionHandlerNotFoundException(version);
@@ -80,15 +81,19 @@
private String getVersion(String id)
{
String version = id;
+
int index = version.lastIndexOf('.');
+
if (index != -1)
{
version = version.substring(index + 1,version.length());
}
+
if (!version.startsWith("v"))
{
version = "v" + version;
}
+
version = version.toUpperCase();
return version;
}
@@ -107,7 +112,7 @@
public Collection<String> getRuntimeTypes()
{
- return runtimeTypes;
+ return _runtimeTypes;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PingThread.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PingThread.java
index 175094e..f788f92 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PingThread.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PingThread.java
@@ -24,18 +24,18 @@
public class PingThread
{
// delay before pinging starts
- private static final int PING_DELAY = 2000;
+ private static final int __PING_DELAY = 2000;
// delay between pings
- private static final int PING_INTERVAL = 250;
+ private static final int __PING_INTERVAL = 250;
// maximum number of pings before giving up
- private int maxPings;
+ private int _maxPings;
- private boolean stop = false;
- private String url;
- private IServer server;
- private JettyServerBehaviour behaviour;
+ private boolean _stop = false;
+ private String _url;
+ private IServer _server;
+ private JettyServerBehaviour _behaviour;
/**
* Create a new PingThread.
@@ -49,10 +49,11 @@
public PingThread(IServer server, String url, int maxPings, JettyServerBehaviour behaviour)
{
super();
- this.server = server;
- this.url = url;
- this.maxPings = maxPings;
- this.behaviour = behaviour;
+
+ this._server = server;
+ this._url = url;
+ this._maxPings = maxPings;
+ this._behaviour = behaviour;
Thread t = new Thread("Jetty Ping Thread")
{
public void run()
@@ -72,44 +73,44 @@
int count = 0;
try
{
- Thread.sleep(PING_DELAY);
+ Thread.sleep(__PING_DELAY);
}
catch (Exception e)
{
// ignore
}
- while (!stop)
+ while (!_stop)
{
try
{
- if (count == maxPings)
+ if (count == _maxPings)
{
try
{
- server.stop(false);
+ _server.stop(false);
}
catch (Exception e)
{
Trace.trace(Trace.FINEST,"Ping: could not stop server");
}
- stop = true;
+ _stop = true;
break;
}
count++;
Trace.trace(Trace.FINEST,"Ping: pinging " + count);
- URL pingUrl = new URL(url);
+ URL pingUrl = new URL(_url);
URLConnection conn = pingUrl.openConnection();
((HttpURLConnection)conn).getResponseCode();
// ping worked - server is up
- if (!stop)
+ if (!_stop)
{
Trace.trace(Trace.FINEST,"Ping: success");
Thread.sleep(200);
- behaviour.setServerStarted();
+ _behaviour.setServerStarted();
}
- stop = true;
+ _stop = true;
}
catch (FileNotFoundException fe)
{
@@ -121,18 +122,18 @@
{
// ignore
}
- behaviour.setServerStarted();
- stop = true;
+ _behaviour.setServerStarted();
+ _stop = true;
}
catch (Exception e)
{
Trace.trace(Trace.FINEST,"Ping: failed");
// pinging failed
- if (!stop)
+ if (!_stop)
{
try
{
- Thread.sleep(PING_INTERVAL);
+ Thread.sleep(__PING_INTERVAL);
}
catch (InterruptedException e2)
{
@@ -149,6 +150,6 @@
public void stop()
{
Trace.trace(Trace.FINEST,"Ping: stopping");
- stop = true;
+ _stop = true;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PublishOperation2.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PublishOperation2.java
index 9024041..508f130 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PublishOperation2.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/PublishOperation2.java
@@ -38,11 +38,11 @@
*/
public class PublishOperation2 extends PublishOperation
{
- protected JettyServerBehaviour server;
- protected IModule[] module;
- protected int kind;
- protected int deltaKind;
- private PublishHelper helper;
+ protected JettyServerBehaviour _server;
+ protected IModule[] _module;
+ protected int _kind;
+ protected int _deltaKind;
+ private PublishHelper _helper;
/**
* Construct the operation object to publish the specified module to the specified server.
@@ -59,20 +59,21 @@
public PublishOperation2(JettyServerBehaviour server, int kind, IModule[] module, int deltaKind)
{
super("Publish to server","Publish Web module to Jetty server");
- this.server = server;
- this.module = module;
- this.kind = kind;
- this.deltaKind = deltaKind;
+
+ this._server = server;
+ this._module = module;
+ this._kind = kind;
+ this._deltaKind = deltaKind;
IPath base = server.getRuntimeBaseDirectory();
if (base != null)
{
- helper = new PublishHelper(base.append("temp").toFile());
+ _helper = new PublishHelper(base.append("temp").toFile());
}
else
{
// We are doomed without a base directory. However, allow the catastrophe
// to occur elsewhere and hope for a useful error message.
- helper = new PublishHelper(null);
+ _helper = new PublishHelper(null);
}
}
@@ -99,24 +100,24 @@
{
List<IStatus> status = new ArrayList<IStatus>();
// If parent web module
- if (module.length == 1)
+ if (_module.length == 1)
{
- publishDir(module[0],status,monitor);
+ publishDir(_module[0],status,monitor);
}
// Else a child module
else
{
- Properties p = server.loadModulePublishLocations();
+ Properties p = _server.loadModulePublishLocations();
// Try to determine the URI for the child module
- IWebModule webModule = (IWebModule)module[0].loadAdapter(IWebModule.class,monitor);
+ IWebModule webModule = (IWebModule)_module[0].loadAdapter(IWebModule.class,monitor);
String childURI = null;
if (webModule != null)
{
- childURI = webModule.getURI(module[1]);
+ childURI = webModule.getURI(_module[1]);
}
// Try to determine if child is binary
- IJ2EEModule childModule = (IJ2EEModule)module[1].loadAdapter(IJ2EEModule.class,monitor);
+ IJ2EEModule childModule = (IJ2EEModule)_module[1].loadAdapter(IJ2EEModule.class,monitor);
boolean isBinary = false;
if (childModule != null)
{
@@ -131,18 +132,18 @@
{
publishJar(childURI,p,status,monitor);
}
- server.saveModulePublishLocations(p);
+ _server.saveModulePublishLocations(p);
}
throwException(status);
- server.setModulePublishState2(module,IServer.PUBLISH_STATE_NONE);
+ _server.setModulePublishState2(_module,IServer.PUBLISH_STATE_NONE);
}
private void publishDir(IModule module2, List status, IProgressMonitor monitor) throws CoreException
{
- IPath path = server.getModuleDeployDirectory(module2);
+ IPath path = _server.getModuleDeployDirectory(module2);
// Remove if requested or if previously published and are now serving without publishing
- if (kind == IServer.PUBLISH_CLEAN || deltaKind == ServerBehaviourDelegate.REMOVED || server.getJettyServer().isServeModulesWithoutPublish())
+ if (_kind == IServer.PUBLISH_CLEAN || _deltaKind == ServerBehaviourDelegate.REMOVED || _server.getJettyServer().isServeModulesWithoutPublish())
{
File f = path.toFile();
if (f.exists())
@@ -151,34 +152,34 @@
addArrayToList(status,stat);
}
- if (deltaKind == ServerBehaviourDelegate.REMOVED || server.getJettyServer().isServeModulesWithoutPublish())
+ if (_deltaKind == ServerBehaviourDelegate.REMOVED || _server.getJettyServer().isServeModulesWithoutPublish())
return;
}
- if (kind == IServer.PUBLISH_CLEAN || kind == IServer.PUBLISH_FULL)
+ if (_kind == IServer.PUBLISH_CLEAN || _kind == IServer.PUBLISH_FULL)
{
- IModuleResource[] mr = server.getResources(module);
- IStatus[] stat = helper.publishFull(mr,path,monitor);
+ IModuleResource[] mr = _server.getResources(_module);
+ IStatus[] stat = _helper.publishFull(mr,path,monitor);
addArrayToList(status,stat);
return;
}
- IModuleResourceDelta[] delta = server.getPublishedResourceDelta(module);
+ IModuleResourceDelta[] delta = _server.getPublishedResourceDelta(_module);
int size = delta.length;
for (int i = 0; i < size; i++)
{
- IStatus[] stat = helper.publishDelta(delta[i],path,monitor);
+ IStatus[] stat = _helper.publishDelta(delta[i],path,monitor);
addArrayToList(status,stat);
}
}
private void publishJar(String jarURI, Properties p, List status, IProgressMonitor monitor) throws CoreException
{
- IPath path = server.getModuleDeployDirectory(module[0]);
+ IPath path = _server.getModuleDeployDirectory(_module[0]);
boolean moving = false;
// Get URI used for previous publish, if known
- String oldURI = (String)p.get(module[1].getId());
+ String oldURI = (String)p.get(_module[1].getId());
if (oldURI != null)
{
// If old URI found, detect if jar is moving or changing its name
@@ -190,7 +191,7 @@
// If we don't have a jar URI, make a guess so we have one if we need it
if (jarURI == null)
{
- jarURI = "WEB-INF/lib/" + module[1].getName() + ".jar";
+ jarURI = "WEB-INF/lib/" + _module[1].getName() + ".jar";
}
IPath jarPath = path.append(jarURI);
// Make our best determination of the path to the old jar
@@ -203,20 +204,20 @@
path = jarPath.removeLastSegments(1);
// Remove if requested or if previously published and are now serving without publishing
- if (moving || kind == IServer.PUBLISH_CLEAN || deltaKind == ServerBehaviourDelegate.REMOVED || server.getJettyServer().isServeModulesWithoutPublish())
+ if (moving || _kind == IServer.PUBLISH_CLEAN || _deltaKind == ServerBehaviourDelegate.REMOVED || _server.getJettyServer().isServeModulesWithoutPublish())
{
File file = oldJarPath.toFile();
if (file.exists())
file.delete();
- p.remove(module[1].getId());
+ p.remove(_module[1].getId());
- if (deltaKind == ServerBehaviourDelegate.REMOVED || server.getJettyServer().isServeModulesWithoutPublish())
+ if (_deltaKind == ServerBehaviourDelegate.REMOVED || _server.getJettyServer().isServeModulesWithoutPublish())
return;
}
- if (!moving && kind != IServer.PUBLISH_CLEAN && kind != IServer.PUBLISH_FULL)
+ if (!moving && _kind != IServer.PUBLISH_CLEAN && _kind != IServer.PUBLISH_FULL)
{
// avoid changes if no changes to module since last publish
- IModuleResourceDelta[] delta = server.getPublishedResourceDelta(module);
+ IModuleResourceDelta[] delta = _server.getPublishedResourceDelta(_module);
if (delta == null || delta.length == 0)
return;
}
@@ -225,18 +226,18 @@
if (!path.toFile().exists())
path.toFile().mkdirs();
- IModuleResource[] mr = server.getResources(module);
- IStatus[] stat = helper.publishZip(mr,jarPath,monitor);
+ IModuleResource[] mr = _server.getResources(_module);
+ IStatus[] stat = _helper.publishZip(mr,jarPath,monitor);
addArrayToList(status,stat);
- p.put(module[1].getId(),jarURI);
+ p.put(_module[1].getId(),jarURI);
}
private void publishArchiveModule(String jarURI, Properties p, List status, IProgressMonitor monitor)
{
- IPath path = server.getModuleDeployDirectory(module[0]);
+ IPath path = _server.getModuleDeployDirectory(_module[0]);
boolean moving = false;
// Get URI used for previous publish, if known
- String oldURI = (String)p.get(module[1].getId());
+ String oldURI = (String)p.get(_module[1].getId());
if (oldURI != null)
{
// If old URI found, detect if jar is moving or changing its name
@@ -248,7 +249,7 @@
// If we don't have a jar URI, make a guess so we have one if we need it
if (jarURI == null)
{
- jarURI = "WEB-INF/lib/" + module[1].getName();
+ jarURI = "WEB-INF/lib/" + _module[1].getName();
}
IPath jarPath = path.append(jarURI);
// Make our best determination of the path to the old jar
@@ -261,22 +262,22 @@
path = jarPath.removeLastSegments(1);
// Remove if requested or if previously published and are now serving without publishing
- if (moving || kind == IServer.PUBLISH_CLEAN || deltaKind == ServerBehaviourDelegate.REMOVED || server.getJettyServer().isServeModulesWithoutPublish())
+ if (moving || _kind == IServer.PUBLISH_CLEAN || _deltaKind == ServerBehaviourDelegate.REMOVED || _server.getJettyServer().isServeModulesWithoutPublish())
{
File file = oldJarPath.toFile();
if (file.exists())
{
file.delete();
}
- p.remove(module[1].getId());
+ p.remove(_module[1].getId());
- if (deltaKind == ServerBehaviourDelegate.REMOVED || server.getJettyServer().isServeModulesWithoutPublish())
+ if (_deltaKind == ServerBehaviourDelegate.REMOVED || _server.getJettyServer().isServeModulesWithoutPublish())
return;
}
- if (!moving && kind != IServer.PUBLISH_CLEAN && kind != IServer.PUBLISH_FULL)
+ if (!moving && _kind != IServer.PUBLISH_CLEAN && _kind != IServer.PUBLISH_FULL)
{
// avoid changes if no changes to module since last publish
- IModuleResourceDelta[] delta = server.getPublishedResourceDelta(module);
+ IModuleResourceDelta[] delta = _server.getPublishedResourceDelta(_module);
if (delta == null || delta.length == 0)
return;
}
@@ -285,10 +286,10 @@
if (!path.toFile().exists())
path.toFile().mkdirs();
- IModuleResource[] mr = server.getResources(module);
- IStatus[] stat = helper.publishToPath(mr,jarPath,monitor);
+ IModuleResource[] mr = _server.getResources(_module);
+ IStatus[] stat = _helper.publishToPath(mr,jarPath,monitor);
addArrayToList(status,stat);
- p.put(module[1].getId(),jarURI);
+ p.put(_module[1].getId(),jarURI);
}
/**
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/PathFileConfig.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/PathFileConfig.java
index 5b6a91e..fed9166 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/PathFileConfig.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/PathFileConfig.java
@@ -17,22 +17,22 @@
public class PathFileConfig
{
- private File file;
- private IPath path;
+ private File _file;
+ private IPath _path;
public PathFileConfig(File file, IPath path)
{
- this.file = file;
- this.path = path;
+ this._file = file;
+ this._path = path;
}
public File getFile()
{
- return file;
+ return _file;
}
public IPath getPath()
{
- return path;
+ return _path;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/StartIni.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/StartIni.java
index 7a93d15..95c6c3d 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/StartIni.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/config/StartIni.java
@@ -33,13 +33,13 @@
public class StartIni implements JettyConstants
{
- private List<PathFileConfig> jettyXMLFiles = new ArrayList<PathFileConfig>();
- private List<PathFileConfig> otherConfigs = new ArrayList<PathFileConfig>();
- private PathFileConfig startConfig = null;
- private PathFileConfig webdefaultXMLConfig = null;
- private File startIniFile;
+ private List<PathFileConfig> _jettyXMLFiles = new ArrayList<PathFileConfig>();
+ private List<PathFileConfig> _otherConfigs = new ArrayList<PathFileConfig>();
+ private PathFileConfig _startConfig = null;
+ private PathFileConfig _webdefaultXMLConfig = null;
+ private File _startIniFile;
- private boolean isStartIniDirty;
+ private boolean _isStartIniDirty;
public StartIni(IPath baseDirPath)
{
@@ -58,14 +58,14 @@
List<String> args = new ArrayList<String>();
if (baseDirPath != null)
{
- IPath startIniPath = baseDirPath.append(START_INI);
- this.startIniFile = startIniPath.toFile();
+ IPath startIniPath = baseDirPath.append(__START_INI);
+ this._startIniFile = startIniPath.toFile();
}
else
{
try
{
- this.startIniFile = IOUtils.toLocalFile(baseDirFolder.getFile(START_INI),null);
+ this._startIniFile = IOUtils.toLocalFile(baseDirFolder.getFile(__START_INI),null);
}
catch (CoreException e)
{
@@ -73,13 +73,13 @@
}
}
- if (startIniFile.exists() && startIniFile.canRead())
+ if (_startIniFile.exists() && _startIniFile.canRead())
{
FileReader reader = null;
BufferedReader buf = null;
try
{
- reader = new FileReader(startIniFile);
+ reader = new FileReader(_startIniFile);
buf = new BufferedReader(reader);
File jettyXMLFile = null;
@@ -110,7 +110,7 @@
}
if (jettyXMLFile != null && jettyXMLFile.exists() && jettyXMLFile.canRead())
{
- jettyXMLFiles.add(new PathFileConfig(jettyXMLFile,new Path(arg)));
+ _jettyXMLFiles.add(new PathFileConfig(jettyXMLFile,new Path(arg)));
}
}
args.add(arg);
@@ -150,32 +150,32 @@
File realmPropertiesFile = realmPropertiesPath.toFile();
if (realmPropertiesFile.exists())
{
- otherConfigs.add(new PathFileConfig(realmPropertiesFile,new Path("etc/realm.properties")));
+ _otherConfigs.add(new PathFileConfig(realmPropertiesFile,new Path("etc/realm.properties")));
}
IPath webdefaultPath = baseDirPath.append("etc/webdefault.xml");
File webdefaultFile = webdefaultPath.toFile();
if (webdefaultFile.exists())
{
- webdefaultXMLConfig = new PathFileConfig(webdefaultFile,new Path("etc/webdefault.xml"));
+ _webdefaultXMLConfig = new PathFileConfig(webdefaultFile,new Path("etc/webdefault.xml"));
}
- IPath startJARPath = baseDirPath.append(START_JAR);
+ IPath startJARPath = baseDirPath.append(__START_JAR);
File startConfigFile = startJARPath.toFile();
if (startConfigFile.exists())
{
- startConfig = new PathFileConfig(startConfigFile,new Path(START_JAR));
+ _startConfig = new PathFileConfig(startConfigFile,new Path(__START_JAR));
}
}
public List<PathFileConfig> getJettyXMLFiles()
{
- return jettyXMLFiles;
+ return _jettyXMLFiles;
}
public PathFileConfig getWebdefaultXMLConfig()
{
- return webdefaultXMLConfig;
+ return _webdefaultXMLConfig;
}
/**
@@ -205,15 +205,15 @@
*/
public void save(IFile file, IProgressMonitor monitor) throws Exception
{
- if (file.exists() && !isStartIniDirty)
+ if (file.exists() && !_isStartIniDirty)
return;
- if (startIniFile == null || !(startIniFile.exists() && startIniFile.canRead()))
+ if (_startIniFile == null || !(_startIniFile.exists() && _startIniFile.canRead()))
return;
InputStream in = null;
try
{
- in = new FileInputStream(startIniFile);
+ in = new FileInputStream(_startIniFile);
if (file.exists())
file.setContents(in,true,true,ProgressUtil.getSubMonitorFor(monitor,200));
else
@@ -234,16 +234,16 @@
// ignore
}
}
- isStartIniDirty = false;
+ _isStartIniDirty = false;
}
public List<PathFileConfig> getOtherConfigs()
{
- return otherConfigs;
+ return _otherConfigs;
}
public PathFileConfig getStartConfig()
{
- return startConfig;
+ return _startConfig;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Configuration.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Configuration.java
index 10cea8d..5e7a6d3 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Configuration.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Configuration.java
@@ -53,19 +53,21 @@
public class Jetty7Configuration extends JettyConfiguration implements JettyConstants
{
+ private StartIni _startIniConfig;
+ protected ServerInstance _serverInstance;
+
+ private boolean _isServerDirty;
+
+ // property change listeners
+ private transient List<PropertyChangeListener> _propertyListeners;
+
+
public Jetty7Configuration(IFolder path)
{
super(path);
}
-
- private StartIni startIniConfig;
-
- protected ServerInstance serverInstance;
- private boolean isServerDirty;
- // property change listeners
- private transient List<PropertyChangeListener> propertyListeners;
-
+
public Collection<ServerPort> getServerPorts()
{
List<ServerPort> ports = new ArrayList<ServerPort>();
@@ -83,7 +85,7 @@
try
{
- Collection<Connector> connectors = serverInstance.getConnectors();
+ Collection<Connector> connectors = _serverInstance.getConnectors();
if (connectors != null)
{
for (Connector connector : connectors)
@@ -97,7 +99,7 @@
{
// ignore
}
- ports.add(new ServerPort("server",Messages.portServer,port,HTTP));
+ ports.add(new ServerPort("server",Messages.portServer,port,__HTTP));
// TODO : how get HTTP type port???
// ports.add(new ServerPort(portId, name, port, protocol2,
@@ -112,7 +114,7 @@
}
if (ports.size() < 1)
{
- ports.add(new ServerPort("server",Messages.portServer,8080,HTTP));
+ ports.add(new ServerPort("server",Messages.portServer,8080,__HTTP));
}
return ports;
@@ -191,7 +193,7 @@
try
{
- Collection<WebAppContext> contexts = serverInstance.getContexts();
+ Collection<WebAppContext> contexts = _serverInstance.getContexts();
if (contexts != null)
{
for (WebAppContext context : contexts)
@@ -215,7 +217,7 @@
{
try
{
- WebAppContext context = serverInstance.createContext(module.getDocumentBase(),module.getMemento(),module.getPath());
+ WebAppContext context = _serverInstance.createContext(module.getDocumentBase(),module.getMemento(),module.getPath());
if (context != null)
{
// context.setDocBase(module.getDocumentBase());
@@ -225,7 +227,7 @@
// if (module.getMemento() != null &&
// module.getMemento().length() > 0)
// context.setSource(module.getMemento());
- isServerDirty = true;
+ _isServerDirty = true;
firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY,null,module);
}
}
@@ -246,8 +248,8 @@
{
try
{
- serverInstance.removeContext(index);
- isServerDirty = true;
+ _serverInstance.removeContext(index);
+ _isServerDirty = true;
firePropertyChangeEvent(REMOVE_WEB_MODULE_PROPERTY,null,index);
}
catch (Exception e)
@@ -258,13 +260,13 @@
protected void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue)
{
- if (propertyListeners == null)
+ if (_propertyListeners == null)
return;
PropertyChangeEvent event = new PropertyChangeEvent(this,propertyName,oldValue,newValue);
try
{
- Iterator<PropertyChangeListener> iterator = propertyListeners.iterator();
+ Iterator<PropertyChangeListener> iterator = _propertyListeners.iterator();
while (iterator.hasNext())
{
try
@@ -292,9 +294,9 @@
*/
public void addPropertyChangeListener(PropertyChangeListener listener)
{
- if (propertyListeners == null)
- propertyListeners = new ArrayList<PropertyChangeListener>();
- propertyListeners.add(listener);
+ if (_propertyListeners == null)
+ _propertyListeners = new ArrayList<PropertyChangeListener>();
+ _propertyListeners.add(listener);
}
/**
@@ -305,8 +307,8 @@
*/
public void removePropertyChangeListener(PropertyChangeListener listener)
{
- if (propertyListeners != null)
- propertyListeners.remove(listener);
+ if (_propertyListeners != null)
+ _propertyListeners.remove(listener);
}
/**
@@ -322,10 +324,10 @@
Factory serverFactory = null;
// Load config.ini
- this.startIniConfig = new StartIni(path);
+ this._startIniConfig = new StartIni(path);
// Load jetty.xml files
- List<PathFileConfig> jettyXMLConfiFiles = startIniConfig.getJettyXMLFiles();
+ List<PathFileConfig> jettyXMLConfiFiles = _startIniConfig.getJettyXMLFiles();
List<Server> servers = new ArrayList<Server>();
Server server = null;
File file = null;
@@ -347,7 +349,7 @@
}
WebApp webApp = null;
- PathFileConfig pathFileConfig = startIniConfig.getWebdefaultXMLConfig();
+ PathFileConfig pathFileConfig = _startIniConfig.getWebdefaultXMLConfig();
if (pathFileConfig != null)
{
File webAppFile = pathFileConfig.getFile();
@@ -368,7 +370,7 @@
// server = (Server) serverFactory.loadDocument(new FileInputStream(
// path.append("jetty.xml").toFile()));
- serverInstance = new ServerInstance(servers,webApp,runtimeBaseDirectory);
+ _serverInstance = new ServerInstance(servers,webApp,runtimeBaseDirectory);
// monitor.worked(1);
//
// webAppDocument = new
@@ -383,7 +385,7 @@
// load policy file
// policyFile = JettyVersionHelper.getFileContents(new
// FileInputStream(path.append("catalina.policy").toFile()));
- monitor.worked(1);
+ //monitor.worked(1);
if (monitor.isCanceled())
return;
@@ -406,10 +408,10 @@
Factory serverFactory = null;
// Load config.ini
- this.startIniConfig = new StartIni(folder);
+ this._startIniConfig = new StartIni(folder);
// Load jetty.xml files
- List<PathFileConfig> jettyXMLConfiFiles = startIniConfig.getJettyXMLFiles();
+ List<PathFileConfig> jettyXMLConfiFiles = _startIniConfig.getJettyXMLFiles();
List<Server> servers = new ArrayList<Server>();
Server server = null;
File file = null;
@@ -436,7 +438,7 @@
monitor.worked(1);
WebApp webApp = null;
- PathFileConfig pathFileConfig = startIniConfig.getWebdefaultXMLConfig();
+ PathFileConfig pathFileConfig = _startIniConfig.getWebdefaultXMLConfig();
if (pathFileConfig != null)
{
File webAppFile = pathFileConfig.getFile();
@@ -450,7 +452,7 @@
}
// server = (Server) serverFactory.loadDocument(new FileInputStream(
// path.append("jetty.xml").toFile()));
- serverInstance = new ServerInstance(servers,webApp,runtimeBaseDirectory);
+ _serverInstance = new ServerInstance(servers,webApp,runtimeBaseDirectory);
// check for catalina.policy to verify that this is a v4.0 config
// IFile file = folder.getFile("catalina.policy");
// if (!file.exists())
@@ -479,7 +481,7 @@
// jettyUsersDocument = XMLUtil.getDocumentBuilder().parse(new
// InputSource(in));
- monitor.worked(200);
+ //monitor.worked(200);
// load catalina.policy
// file = folder.getFile("catalina.policy");
@@ -518,8 +520,8 @@
if (monitor.isCanceled())
return;
- startIniConfig.save(folder.getFile(START_INI),monitor);
- serverInstance.save(folder,monitor);
+ _startIniConfig.save(folder.getFile(__START_INI),monitor);
+ _serverInstance.save(folder,monitor);
// get etc/realm.properties
// get etc/webdefault.xml
@@ -528,7 +530,7 @@
IFolder newFolder = folder;
IPath path = null;
String filename = null;
- List<PathFileConfig> otherConfigs = startIniConfig.getOtherConfigs();
+ List<PathFileConfig> otherConfigs = _startIniConfig.getOtherConfigs();
for (PathFileConfig pathFileConfig : otherConfigs)
{
path = pathFileConfig.getPath();
@@ -552,7 +554,7 @@
}
// start.config from start.jar
- PathFileConfig startConfig = startIniConfig.getStartConfig();
+ PathFileConfig startConfig = _startIniConfig.getStartConfig();
if (startConfig != null)
{
File startJARFile = startConfig.getFile();
@@ -588,7 +590,7 @@
// catalina.base will be used
if (isTestEnv)
{
- while (serverInstance.removeContext(0))
+ while (_serverInstance.removeContext(0))
{
// no-op
}
@@ -609,8 +611,8 @@
{
if ("server".equals(id))
{
- serverInstance.setPort(port + "");
- isServerDirty = true;
+ _serverInstance.setPort(port + "");
+ _isServerDirty = true;
firePropertyChangeEvent(MODIFY_PORT_PROPERTY,id, Integer.valueOf(port));
return;
}
@@ -662,12 +664,12 @@
{
try
{
- WebAppContext context = serverInstance.getContext(index);
+ WebAppContext context = _serverInstance.getContext(index);
if (context != null)
{
context.setContextPath(path);
context.save();
- isServerDirty = true;
+ _isServerDirty = true;
WebModule module = new WebModule(path,docBase,null,reloadable);
firePropertyChangeEvent(MODIFY_WEB_MODULE_PROPERTY, Integer.valueOf(index),module);
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Handler.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Handler.java
index 025660f..cb71169 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Handler.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Handler.java
@@ -25,16 +25,17 @@
public class Jetty7Handler extends JettyHandler
{
- protected static final IStatus startJarRequiredInstallDirStatus = new Status(IStatus.ERROR,JettyPlugin.PLUGIN_ID,0,
+ protected static final IStatus __START_JAR_REQUIRED_STATUS = new Status(IStatus.ERROR,JettyPlugin.PLUGIN_ID,0,
Messages.startJarRequiredInstallDirStatus,null);
public IStatus verifyInstallPath(IPath installPath)
{
IStatus result = JettyVersionHelper.checkJettyVersion(installPath);
+
if (result.getSeverity() == IStatus.CANCEL)
{
// TODO : search in a folder.
- return startJarRequiredInstallDirStatus;
+ return __START_JAR_REQUIRED_STATUS;
}
return result;
@@ -52,8 +53,14 @@
public IStatus canAddModule(IModule module)
{
String version = module.getModuleType().getVersion();
- if ("2.2".equals(version) || "2.3".equals(version) || "2.4".equals(version) || "2.5".equals(version))
+
+ if ("2.2".equals(version) ||
+ "2.3".equals(version) ||
+ "2.4".equals(version) ||
+ "2.5".equals(version))
+ {
return Status.OK_STATUS;
+ }
return new Status(IStatus.ERROR,JettyPlugin.PLUGIN_ID,0,Messages.errorSpec70,null);
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Provider.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Provider.java
index 36dd928..bf5b390 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Provider.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty7/Jetty7Provider.java
@@ -18,13 +18,13 @@
public class Jetty7Provider implements IJettyVersionProvider
{
- public static final IJettyVersionProvider INSTANCE = new Jetty7Provider();
+ public static final IJettyVersionProvider __INSTANCE = new Jetty7Provider();
- private IJettyVersionHandler versionHandler = new Jetty7Handler();
+ private IJettyVersionHandler _versionHandler = new Jetty7Handler();
public IJettyVersionHandler getJettyVersionHandler()
{
- return versionHandler;
+ return _versionHandler;
}
public IJettyConfiguration createJettyConfiguration(IFolder path)
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Handler.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Handler.java
index 8fb57fd..7a359ef 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Handler.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Handler.java
@@ -27,8 +27,15 @@
public IStatus canAddModule(IModule module)
{
String version = module.getModuleType().getVersion();
- if ("2.2".equals(version) || "2.3".equals(version) || "2.4".equals(version) || "2.5".equals(version) || "3.0".equals(version))
+
+ if ("2.2".equals(version) ||
+ "2.3".equals(version) ||
+ "2.4".equals(version) ||
+ "2.5".equals(version) ||
+ "3.0".equals(version))
+ {
return Status.OK_STATUS;
+ }
return new Status(IStatus.ERROR,JettyPlugin.PLUGIN_ID,0,Messages.errorSpec70,null);
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Provider.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Provider.java
index 132e3b8..43b52d2 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Provider.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/jetty8/Jetty8Provider.java
@@ -19,13 +19,13 @@
public class Jetty8Provider implements IJettyVersionProvider
{
- public static final IJettyVersionProvider INSTANCE = new Jetty8Provider();
+ public static final IJettyVersionProvider __INSTANCE = new Jetty8Provider();
- private IJettyVersionHandler versionHandler = new Jetty8Handler();
+ private IJettyVersionHandler _versionHandler = new Jetty8Handler();
public IJettyVersionHandler getJettyVersionHandler()
{
- return versionHandler;
+ return _versionHandler;
}
public IJettyConfiguration createJettyConfiguration(IFolder path)
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/IOUtils.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/IOUtils.java
index 4be2135..88ef57c 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/IOUtils.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/IOUtils.java
@@ -37,7 +37,7 @@
public class IOUtils
{
- private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+ private static final int __DEFAULT_BUFFER_SIZE = 1024 * 4;
/**
* Converts the given URI to a local file. Use the existing file if the uri is on the local file system. Otherwise fetch it. Returns null if unable to fetch
@@ -115,7 +115,7 @@
*/
public static int copy(InputStream input, OutputStream output) throws IOException
{
- byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ byte[] buffer = new byte[__DEFAULT_BUFFER_SIZE];
int count = 0;
int n = 0;
while (-1 != (n = input.read(buffer)))
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/JettyVersionHelper.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/JettyVersionHelper.java
index c011bb5..1563ab0 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/JettyVersionHelper.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/util/JettyVersionHelper.java
@@ -30,7 +30,7 @@
public static IStatus checkJettyVersion(IPath installPath)
{
// Search start.jar
- IPath startJarPath = installPath.append(START_JAR);
+ IPath startJarPath = installPath.append(__START_JAR);
File jarFile = null;
jarFile = startJarPath.toFile();
// If jar is not at expected location, try alternate location
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/Factory.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/Factory.java
index fa2105f..4ca2bf0 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/Factory.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/Factory.java
@@ -27,8 +27,8 @@
*/
public class Factory
{
- protected String packageName;
- protected Document document;
+ protected String _packageName;
+ protected Document _document;
public Factory()
{
@@ -37,7 +37,7 @@
protected Attr createAttribute(String s, Element element)
{
- Attr attr = document.createAttribute(s);
+ Attr attr = _document.createAttribute(s);
element.setAttributeNode(attr);
return attr;
}
@@ -47,7 +47,7 @@
if (index < 0)
return createElement(s,node);
- Element element = document.createElement(s);
+ Element element = _document.createElement(s);
try
{
Node child = node.getFirstChild();
@@ -78,14 +78,14 @@
protected XMLElement createElement(String s, Node node)
{
- Element element = document.createElement(s);
+ Element element = _document.createElement(s);
node.appendChild(element);
return newInstance(element);
}
public byte[] getContents() throws IOException
{
- return XMLUtil.getContents(document);
+ return XMLUtil.getContents(_document);
}
/**
@@ -94,20 +94,20 @@
*/
public Document getDocument()
{
- return document;
+ return _document;
}
public String getPackageName()
{
- return packageName;
+ return _packageName;
}
public XMLElement loadDocument(InputStream in) throws IOException, SAXException
{
try
{
- document = XMLUtil.getDocumentBuilder().parse(new InputSource(in));
- Element element = document.getDocumentElement();
+ _document = XMLUtil.getDocumentBuilder().parse(new InputSource(in));
+ Element element = _document.getDocumentElement();
return newInstance(element);
}
catch (IllegalArgumentException exception)
@@ -147,8 +147,8 @@
}
// add package name
- if (packageName != null)
- s = packageName + "." + s;
+ if (_packageName != null)
+ s = _packageName + "." + s;
Class class1 = Class.forName(s);
XMLElement xmlElement = (XMLElement)class1.newInstance();
@@ -165,16 +165,16 @@
public void save(String filename) throws IOException
{
- XMLUtil.save(filename,document);
+ XMLUtil.save(filename,_document);
}
public void setDocument(Document d)
{
- document = d;
+ _document = d;
}
public void setPackageName(String s)
{
- packageName = s;
+ _packageName = s;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLElement.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLElement.java
index 98ff17b..4b8ee9a 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLElement.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLElement.java
@@ -27,8 +27,8 @@
*/
public class XMLElement
{
- private Element xmlElement;
- protected Factory factory;
+ private Element _xmlElement;
+ protected Factory _factory;
public XMLElement()
{
@@ -37,41 +37,41 @@
public void setText(String textContent)
{
- xmlElement.setTextContent(textContent);
+ _xmlElement.setTextContent(textContent);
}
public Element getElementNode()
{
- return xmlElement;
+ return _xmlElement;
}
public Attr addAttribute(String s, String s1)
{
- Attr attr = factory.createAttribute(s,xmlElement);
+ Attr attr = _factory.createAttribute(s,_xmlElement);
attr.setValue(s1);
return attr;
}
public XMLElement createElement(int index, String s)
{
- return factory.createElement(index,s,xmlElement);
+ return _factory.createElement(index,s,_xmlElement);
}
public XMLElement createElement(String s)
{
- return factory.createElement(s,xmlElement);
+ return _factory.createElement(s,_xmlElement);
}
public XMLElement findElement(String s)
{
- NodeList nodelist = xmlElement.getElementsByTagName(s);
+ NodeList nodelist = _xmlElement.getElementsByTagName(s);
int i = nodelist == null?0:nodelist.getLength();
for (int j = 0; j < i; j++)
{
Node node = nodelist.item(j);
String s1 = node.getNodeName().trim();
if (s1.equals(s))
- return factory.newInstance((Element)node);
+ return _factory.newInstance((Element)node);
}
return createElement(s);
@@ -79,14 +79,14 @@
public XMLElement findElement(String s, int i)
{
- NodeList nodelist = xmlElement.getElementsByTagName(s);
+ NodeList nodelist = _xmlElement.getElementsByTagName(s);
int j = nodelist == null?0:nodelist.getLength();
for (int k = 0; k < j; k++)
{
Node node = nodelist.item(k);
String s1 = node.getNodeName().trim();
if (s1.equals(s) && k == i)
- return factory.newInstance((Element)node);
+ return _factory.newInstance((Element)node);
}
return createElement(s);
@@ -94,7 +94,7 @@
public Element findElement(String s, String attrName)
{
- return findElement(xmlElement,s,attrName);
+ return findElement(_xmlElement,s,attrName);
}
public Element findElement(Element element, String s, String attrName)
@@ -131,7 +131,7 @@
public String getAttributeValue(String s)
{
- Attr attr = xmlElement.getAttributeNode(s);
+ Attr attr = _xmlElement.getAttributeNode(s);
if (attr != null)
return attr.getValue();
@@ -141,7 +141,7 @@
public Map getAttributes()
{
Map attributes = new LinkedHashMap();
- NamedNodeMap attrs = xmlElement.getAttributes();
+ NamedNodeMap attrs = _xmlElement.getAttributes();
if (null != attrs)
{
for (int i = 0; i < attrs.getLength(); i++)
@@ -157,12 +157,12 @@
public String getElementName()
{
- return xmlElement.getNodeName();
+ return _xmlElement.getNodeName();
}
public String getElementValue()
{
- return getElementValue(xmlElement);
+ return getElementValue(_xmlElement);
}
protected static String getElementValue(Element element)
@@ -180,7 +180,7 @@
public Element getSubElement(String s)
{
- NodeList nodelist = xmlElement.getElementsByTagName(s);
+ NodeList nodelist = _xmlElement.getElementsByTagName(s);
int i = nodelist == null?0:nodelist.getLength();
for (int j = 0; j < i; j++)
{
@@ -210,7 +210,7 @@
{
try
{
- xmlElement.removeAttribute(s);
+ _xmlElement.removeAttribute(s);
return true;
}
catch (Exception ex)
@@ -221,7 +221,7 @@
public boolean removeElement(String s, int i)
{
- NodeList nodelist = xmlElement.getElementsByTagName(s);
+ NodeList nodelist = _xmlElement.getElementsByTagName(s);
int j = nodelist == null?0:nodelist.getLength();
for (int k = 0; k < j; k++)
{
@@ -229,7 +229,7 @@
String s1 = node.getNodeName().trim();
if (s1.equals(s) && k == i)
{
- xmlElement.removeChild(node);
+ _xmlElement.removeChild(node);
return true;
}
}
@@ -239,7 +239,7 @@
public void setAttributeValue(String s, String s1)
{
- Attr attr = xmlElement.getAttributeNode(s);
+ Attr attr = _xmlElement.getAttributeNode(s);
if (attr == null)
attr = addAttribute(s,s1);
else
@@ -248,7 +248,7 @@
void setElement(Element element)
{
- xmlElement = element;
+ _xmlElement = element;
}
protected static void setElementValue(Element element, String value)
@@ -273,12 +273,12 @@
void setFactory(Factory factory1)
{
- factory = factory1;
+ _factory = factory1;
}
public Factory getFactory()
{
- return factory;
+ return _factory;
}
public void setSubElementValue(String s, String value)
@@ -286,16 +286,16 @@
Element element = getSubElement(s);
if (element == null)
{
- element = factory.document.createElement(s);
- element.appendChild(factory.document.createTextNode("temp"));
- xmlElement.appendChild(element);
+ element = _factory._document.createElement(s);
+ element.appendChild(_factory._document.createTextNode("temp"));
+ _xmlElement.appendChild(element);
}
setElementValue(element,value);
}
public int sizeOfElement(String s)
{
- NodeList nodelist = xmlElement.getElementsByTagName(s);
+ NodeList nodelist = _xmlElement.getElementsByTagName(s);
int i = nodelist == null?0:nodelist.getLength();
return i;
}
@@ -304,11 +304,11 @@
{
try
{
- xmlElement.setNodeValue(s);
+ _xmlElement.setNodeValue(s);
}
catch (DOMException ex)
{
- NodeList nodelist = xmlElement.getChildNodes();
+ NodeList nodelist = _xmlElement.getChildNodes();
int i = nodelist == null?0:nodelist.getLength();
if (i > 0)
{
@@ -321,27 +321,27 @@
}
else
{
- xmlElement.appendChild(factory.document.createTextNode(s));
+ _xmlElement.appendChild(_factory._document.createTextNode(s));
}
}
}
public boolean hasChildNodes()
{
- return xmlElement.hasChildNodes();
+ return _xmlElement.hasChildNodes();
}
public void removeChildren()
{
- while (xmlElement.hasChildNodes())
+ while (_xmlElement.hasChildNodes())
{
- xmlElement.removeChild(xmlElement.getFirstChild());
+ _xmlElement.removeChild(_xmlElement.getFirstChild());
}
}
public void copyChildrenTo(XMLElement destination)
{
- NodeList nodelist = xmlElement.getChildNodes();
+ NodeList nodelist = _xmlElement.getChildNodes();
int len = nodelist == null?0:nodelist.getLength();
for (int i = 0; i < len; i++)
{
@@ -352,7 +352,7 @@
public void importNode(Node node, boolean deep)
{
- xmlElement.appendChild(xmlElement.getOwnerDocument().importNode(node,deep));
+ _xmlElement.appendChild(_xmlElement.getOwnerDocument().importNode(node,deep));
}
/**
@@ -371,7 +371,7 @@
{
try
{
- return elementsAreEquivalent(xmlElement,obj.getElementNode());
+ return elementsAreEquivalent(_xmlElement,obj.getElementNode());
}
catch (Exception e)
{
@@ -392,7 +392,7 @@
{
if (obj != null)
{
- return elementsAreEquivalent(xmlElement,obj.getElementNode());
+ return elementsAreEquivalent(_xmlElement,obj.getElementNode());
}
return false;
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java
index 7e3767d..e5b7d42 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/XMLUtil.java
@@ -43,7 +43,7 @@
*/
public class XMLUtil
{
- private static DocumentBuilder documentBuilder;
+ private static DocumentBuilder _documentBuilder;
/**
* XMLUtil constructor comment.
@@ -55,7 +55,7 @@
public static DocumentBuilder getDocumentBuilder()
{
- if (documentBuilder == null)
+ if (_documentBuilder == null)
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
@@ -72,8 +72,8 @@
// Ignore if feature isn't supported
}
// factory.setAttribute("http://apache.org/xml/features/nonvalidating/load-external-dtd", new Boolean(false));
- documentBuilder = factory.newDocumentBuilder();
- documentBuilder.setEntityResolver(new EntityResolver()
+ _documentBuilder = factory.newDocumentBuilder();
+ _documentBuilder.setEntityResolver(new EntityResolver()
{
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
{
@@ -86,7 +86,7 @@
Trace.trace(Trace.SEVERE,"Error creating document builder");
}
- return documentBuilder;
+ return _documentBuilder;
}
/**
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/ServerInstance.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/ServerInstance.java
index 6ce423d..eaf5b33 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/ServerInstance.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/ServerInstance.java
@@ -36,26 +36,29 @@
public class ServerInstance
{
- private List<Server> jettyServers;
- private IPath runtimeBaseDirectory;
- private boolean contextsLoaded = false;
- private List<WebAppContext> webAppContexts = new ArrayList<WebAppContext>();
- private WebApp webApp = null;
+ private List<Server> _jettyServers;
+ private IPath _runtimeBaseDirectory;
+ private boolean _contextsLoaded = false;
+ private List<WebAppContext> _webAppContexts = new ArrayList<WebAppContext>();
+ private WebApp _webApp = null;
public ServerInstance(List<Server> jettyServers, WebApp webApp, IPath runtimeBaseDirectory)
{
if (jettyServers == null)
+ {
throw new IllegalArgumentException("Jetty Server argument may not be null.");
- this.jettyServers = jettyServers;
- this.runtimeBaseDirectory = runtimeBaseDirectory;
- this.webApp = webApp;
+ }
+
+ this._jettyServers = jettyServers;
+ this._runtimeBaseDirectory = runtimeBaseDirectory;
+ this._webApp = webApp;
}
public List<Connector> getConnectors()
{
List<Connector> allConnectors = null;
List<Connector> serverConnectors = null;
- for (Server server : jettyServers)
+ for (Server server : _jettyServers)
{
serverConnectors = server.getConnectors();
if (serverConnectors != null)
@@ -72,9 +75,9 @@
public boolean removeContext(int index)
{
- if (index >= webAppContexts.size())
+ if (index >= _webAppContexts.size())
return false;
- WebAppContext webAppContext = webAppContexts.remove(index);
+ WebAppContext webAppContext = _webAppContexts.remove(index);
if (webAppContext != null)
{
IPath contextFilePath = getXMLContextFilePath(webAppContext.getContextPath());
@@ -89,7 +92,7 @@
public List<Server> getJettyServers()
{
- return jettyServers;
+ return _jettyServers;
}
public void save(final IFolder folder, IProgressMonitor monitor) throws IOException, CoreException
@@ -99,7 +102,7 @@
byte[] data = null;
InputStream in = null;
IFolder newFolder = folder;
- for (Server jettyServer : jettyServers)
+ for (Server jettyServer : _jettyServers)
{
path = jettyServer.getPath();
if (path.segmentCount() > 1)
@@ -122,17 +125,17 @@
else
file.create(in,true,ProgressUtil.getSubMonitorFor(monitor,200));
}
- if (webApp != null)
+ if (_webApp != null)
{
- path = webApp.getPath();
+ path = _webApp.getPath();
if (path.segmentCount() > 1)
{
newFolder = folder.getFolder(path.removeLastSegments(1));
IOUtils.createFolder(newFolder,monitor);
}
- filename = webApp.getFile().getName();
- data = webApp.getFactory().getContents();
+ filename = _webApp.getFile().getName();
+ data = _webApp.getFactory().getContents();
in = new ByteArrayInputStream(data);
IFile file = newFolder.getFile(filename);
if (file.exists())
@@ -184,7 +187,7 @@
}
// Save it as file in the WTP /contexts
String fileName = pathWithoutSlash + ".xml";
- IPath contextFolderPath = runtimeBaseDirectory.append("contexts");
+ IPath contextFolderPath = _runtimeBaseDirectory.append("contexts");
File folder = contextFolderPath.toFile();
if (!folder.exists())
{
@@ -198,18 +201,18 @@
Factory webAppContextFactory = new Factory();
webAppContextFactory.setPackageName("org.eclipse.jst.server.jetty.core.internal.xml.jetty7.webapp");
WebAppContext context = (WebAppContext)webAppContextFactory.loadDocument(stream);
- webAppContexts.add(context);
+ _webAppContexts.add(context);
return context;
}
private void loadContextsIfNeeded()
{
- if (contextsLoaded)
+ if (_contextsLoaded)
return;
try
{
WebAppContext context = null;
- IPath contexts = runtimeBaseDirectory.append("contexts");
+ IPath contexts = _runtimeBaseDirectory.append("contexts");
File contextsFolder = contexts.toFile();
if (contextsFolder.exists())
{
@@ -248,14 +251,14 @@
}
finally
{
- contextsLoaded = true;
+ _contextsLoaded = true;
}
}
public Collection<WebAppContext> getContexts()
{
loadContextsIfNeeded();
- return webAppContexts;
+ return _webAppContexts;
}
public void setPort(String port)
@@ -271,7 +274,7 @@
public WebAppContext getContext(int index)
{
- return webAppContexts.get(index);
+ return _webAppContexts.get(index);
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Connector.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Connector.java
index 2e7df37..0f14e0b 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Connector.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Connector.java
@@ -16,16 +16,16 @@
public class Connector
{
- private Element portElement;
+ private Element _portElement;
public Connector(Element portElement)
{
- this.portElement = portElement;
+ this._portElement = portElement;
}
public String getPort()
{
- Node firstChild = portElement.getFirstChild();
+ Node firstChild = _portElement.getFirstChild();
if (firstChild.getNodeType() == Node.ELEMENT_NODE)
{
// SystemProperty default=""
@@ -34,13 +34,13 @@
}
else
{
- return portElement.getTextContent();
+ return _portElement.getTextContent();
}
}
public void setPort(String port)
{
- portElement.setTextContent(port);
+ _portElement.setTextContent(port);
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Server.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Server.java
index df8186e..96828f4 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Server.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/Server.java
@@ -22,8 +22,8 @@
public class Server extends XMLElement
{
- private File file;
- private IPath path;
+ private File _file;
+ private IPath _path;
public List<Connector> getConnectors()
{
@@ -53,22 +53,22 @@
public void setFile(File jettyXMLFile)
{
- this.file = jettyXMLFile;
+ this._file = jettyXMLFile;
}
public File getFile()
{
- return file;
+ return _file;
}
public IPath getPath()
{
- return path;
+ return _path;
}
public void setPath(IPath path)
{
- this.path = path;
+ this._path = path;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/WebApp.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/WebApp.java
index 8cb9601..01e2034 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/WebApp.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/server/WebApp.java
@@ -18,27 +18,27 @@
public class WebApp extends XMLElement
{
- private File file;
- private IPath path;
+ private File _file;
+ private IPath _path;
public File getFile()
{
- return file;
+ return _file;
}
public void setFile(File file)
{
- this.file = file;
+ this._file = file;
}
public IPath getPath()
{
- return path;
+ return _path;
}
public void setPath(IPath path)
{
- this.path = path;
+ this._path = path;
}
}
diff --git a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/webapp/WebAppContext.java b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/webapp/WebAppContext.java
index 540d61b..bbca198 100644
--- a/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/webapp/WebAppContext.java
+++ b/org.eclipse.jst.server.jetty.core/src/org/eclipse/jst/server/jetty/core/internal/xml/jetty7/webapp/WebAppContext.java
@@ -22,9 +22,9 @@
public class WebAppContext extends XMLElement
{
- private File saveFile;
- private String memento;
- private String documentBase;
+ private File _saveFile;
+ private String _memento;
+ private String _documentBase;
public void setContextPath(String contextPath)
{
@@ -69,19 +69,19 @@
public void save() throws IOException
{
- XMLUtil.save(saveFile.getCanonicalPath(),getElementNode().getOwnerDocument());
+ XMLUtil.save(_saveFile.getCanonicalPath(),getElementNode().getOwnerDocument());
}
public void setSaveFile(File saveFile)
{
- this.saveFile = saveFile;
+ this._saveFile = saveFile;
String war = getWar();
File warFile = new File(war);
if (war != null && warFile.exists())
{
try
{
- this.documentBase = warFile.getCanonicalPath();
+ this._documentBase = warFile.getCanonicalPath();
}
catch (IOException e)
{
@@ -91,19 +91,19 @@
}
else
{
- this.documentBase = saveFile.getName();
- int index = documentBase.lastIndexOf('.');
+ this._documentBase = saveFile.getName();
+ int index = _documentBase.lastIndexOf('.');
if (index != -1)
{
- documentBase = documentBase.substring(0,index);
+ _documentBase = _documentBase.substring(0,index);
}
- this.memento = "org.eclipse.jst.jee.server:" + documentBase;
+ this._memento = "org.eclipse.jst.jee.server:" + _documentBase;
}
}
public String getMemento()
{
- return memento;
+ return _memento;
}
// public void setMemento(String memento) {
@@ -112,7 +112,7 @@
public String getDocumentBase()
{
- return documentBase;
+ return _documentBase;
}
// public void setDocumentBase(String documentBase) {