classpathhelper.eclipse.tomcat.listener.ui
Class TomcatClassPathListener

java.lang.Object
  extended byclasspathhelper.eclipse.ui.AbstractClassPathModel
      extended byclasspathhelper.eclipse.tomcat.listener.ui.TomcatClassPathListener
All Implemented Interfaces:
IClassPathModel, IFileChangeListener

public class TomcatClassPathListener
extends AbstractClassPathModel
implements IFileChangeListener

Class responsible for providing the Tomcat class loaders based on the configured preferences.

This class listens to the PreferenceStore for changes to events that result in either a new version/location for the Tomcat instance or a new app within the current instance.

This class also monitors files (classes/jars) used by the in-use classloader for updates/deletes/additions. If a change is detected this class will send out a new classloader to reflect the changes.

Implementation Notes

This listener caches classloaders so that switching between Tomcat applications doesn't force the recalculating of the classpath when returning to a classloader hierarchy that has already been visited.

Since:
1.0
Author:
bharris

Constructor Summary
TomcatClassPathListener()
          Constructor (registers the listener with the property store).
 
Method Summary
 void fileChanged(FileChangeMonitor monitor, FileChangedEvent[] evts)
          Callback method indicating file(s) have changed.
protected  CGClassLoader getCurrentClassLoader()
          Internal method used to obtain the current classloader for AbstractClassPathModel.addClassPathChangeListener(IClassPathChangeListener).
 void propertyChange(PropertyChangeEvent evt)
           
protected  void sendClassPathEvent()
          Internal method that looks at the current tomcat properties and fires a change event if the properties warrant it.
 void startClassPathListening()
          Method called to indicate that this model is the selected model and should start sending classpath change events.
 void stopClassPathListening()
          Method called to indicate that this model is nolonger the selected model and can clean up any listeners it has started (as well as any caching.
 
Methods inherited from class classpathhelper.eclipse.ui.AbstractClassPathModel
addClassPathChangeListener, fireClassPathChangeEvent, getNumberOfListeners, removeClassPathChangeListener, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TomcatClassPathListener

public TomcatClassPathListener()
Constructor (registers the listener with the property store).

Since:
1.0
Method Detail

sendClassPathEvent

protected void sendClassPathEvent()
Internal method that looks at the current tomcat properties and fires a change event if the properties warrant it.

Since:
1.0

getCurrentClassLoader

protected CGClassLoader getCurrentClassLoader()
Description copied from class: AbstractClassPathModel
Internal method used to obtain the current classloader for AbstractClassPathModel.addClassPathChangeListener(IClassPathChangeListener). If not class loader exists, this method should return null.

Specified by:
getCurrentClassLoader in class AbstractClassPathModel
Returns:
The current class loader.

startClassPathListening

public void startClassPathListening()
Description copied from interface: IClassPathModel

Method called to indicate that this model is the selected model and should start sending classpath change events. If a model needs to attach any listeners this is a good point to do so.

A model should also use this call send its initial class loader via its IClassPathChangeListener objects.

Specified by:
startClassPathListening in interface IClassPathModel

stopClassPathListening

public void stopClassPathListening()
Description copied from interface: IClassPathModel
Method called to indicate that this model is nolonger the selected model and can clean up any listeners it has started (as well as any caching.

Specified by:
stopClassPathListening in interface IClassPathModel

fileChanged

public void fileChanged(FileChangeMonitor monitor,
                        FileChangedEvent[] evts)
Description copied from interface: IFileChangeListener
Callback method indicating file(s) have changed.

Specified by:
fileChanged in interface IFileChangeListener
Parameters:
monitor - The monitor these changes are from.
evts - An array of the events representing all the file changes.

propertyChange

public void propertyChange(PropertyChangeEvent evt)