Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-09-09 14:09:04 -0400
committerpelder2008-09-09 14:09:04 -0400
commit2587536a7c919a0b6c56e593aad781b13cd4012b (patch)
tree38d87cc6aa7dfd1567513a961cca4b1f6c5d9b4f
parent43ffe7d9094fc0260e7aede2ce834fbd637c8fa4 (diff)
downloadorg.eclipse.jet-2587536a7c919a0b6c56e593aad781b13cd4012b.tar.gz
org.eclipse.jet-2587536a7c919a0b6c56e593aad781b13cd4012b.tar.xz
org.eclipse.jet-2587536a7c919a0b6c56e593aad781b13cd4012b.zip
[246570] Possible Eclipse dead-lock during JET XPath function initialization
-rw-r--r--plugins/org.eclipse.jet/.options1
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/InternalJET2Platform.java215
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/SavedStateManager.java9
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/Messages.java43
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelInspectorsManager.java10
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelLoaderExtManager.java9
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java17
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/StaleXPathFunctionWrapper.java48
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/UnableToLoadXPathFunctionWrapper.java51
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/WorkspaceTagLibraryManager.java12
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionLazyLoadWrapper.java86
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionNotImplementedWrapper.java50
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionsManager.java69
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/messages.properties4
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/InternalTagLibManager.java10
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathFunctionMetaData.java10
16 files changed, 563 insertions, 81 deletions
diff --git a/plugins/org.eclipse.jet/.options b/plugins/org.eclipse.jet/.options
index 98fb8c3..3716f92 100644
--- a/plugins/org.eclipse.jet/.options
+++ b/plugins/org.eclipse.jet/.options
@@ -10,4 +10,5 @@ org.eclipse.jet/debug/xpath/compilations=false
org.eclipse.jet/debug/savedState=false
org.eclipse.jet/debug/pluginProjectMonitor=false
org.eclipse.jet/debug/modelLoaderExtensions=false
+org.eclipse.jet/debug/startup=false
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/InternalJET2Platform.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/InternalJET2Platform.java
index a9b89a8..c87a45c 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/InternalJET2Platform.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/InternalJET2Platform.java
@@ -45,6 +45,51 @@ import org.osgi.framework.BundleContext;
public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
{
+ /**
+ * Protocol for startup/shutdown method timer
+ */
+ public interface IMethodTimer {
+ public void done();
+ }
+
+ /**
+ * Implementation of method timer
+ */
+ private static class MethodTimer implements IMethodTimer {
+
+ private final Class clazz;
+ private final String methodName;
+ private final long startMilliseconds;
+
+ public MethodTimer(Class clazz, String methodName) {
+ this.clazz = clazz;
+ this.methodName = methodName;
+ this.startMilliseconds = System.currentTimeMillis();
+ System.out.println(clazz.getName() + "." + methodName + " - entering at " + startMilliseconds); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void done()
+ {
+ long endMillis = System.currentTimeMillis();
+ long millis = endMillis - startMilliseconds;
+ System.out.println(clazz.getName() + "." + methodName + " - exiting at " + endMillis + " - " + millis + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+ }
+
+ /**
+ * A do nothing method timer
+ */
+ private static final IMethodTimer NULL_METHOD_TIMER = new IMethodTimer() {
+
+ public void done(){}
+
+ };
+
+ /**
+ * When <code>true</code>, indicates that startup/shutdown tracing is active
+ */
+ private static boolean DEBUG_STARTUP = Boolean.valueOf(Platform.getDebugOption("org.eclipse.jet/debug/startup")).booleanValue(); //$NON-NLS-1$
+
//The shared instance.
private static InternalJET2Platform plugin;
@@ -65,7 +110,23 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
private WorkspaceTagLibraryManager workspaceTagLibraryManager = null;
private SavedStateManager savedStateManager = null;
-
+
+ private BundleContext bundleContext;
+
+ /**
+ * Return a method timer that is active only when DEBUG_STARTUP is true.
+ * @param clazz
+ * @param methodName
+ * @return
+ */
+ public static IMethodTimer getStartupMethodTimer(Class clazz, String methodName) {
+ if(DEBUG_STARTUP) {
+ return new MethodTimer(clazz, methodName);
+ } else {
+ return NULL_METHOD_TIMER;
+ }
+ }
+
/**
* Returns the shared instance.
* @return the plugin instance
@@ -195,6 +256,8 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public TagLibrary getTagLibrary(String id)
{
+ checkTagLibManager();
+
return tagLibManager.getTagLibrary(id);
}
@@ -206,6 +269,8 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public TagLibrary getWorkspaceTagLibrary(String id)
{
+ checkWorkspaceTagLibraryManager();
+
return workspaceTagLibraryManager.getTagLibrary(id);
}
@@ -216,6 +281,8 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public IProject getProjectDefiningTagLibrary(String id)
{
+ checkWorkspaceTagLibraryManager();
+
return workspaceTagLibraryManager.getProjectDefiningTagLibrary(id);
}
/**
@@ -224,6 +291,8 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public JETBundleInstaller getJETBundleInstaller()
{
+ checkJETBundleInstaller();
+
return jetBundleInstaller;
}
@@ -234,8 +303,12 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public void start(BundleContext context) throws Exception
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "start(BundleContext)"); //$NON-NLS-1$
+
super.start(context);
+ this.bundleContext = context;
+
// start the model inspectors early, they are used by other managers...
modelInspectorExtManager = new ModelInspectorsManager();
modelInspectorExtManager.startup();
@@ -244,28 +317,60 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
modelLoaderExtManager = new ModelLoaderExtManager();
modelLoaderExtManager.startup();
- // start the XPath function extensions early, they are used by other managers...
- xpathFunctionsManager = new XPathFunctionsManager();
- xpathFunctionsManager.startup();
+ ContextLogEntryFactoryManager.setFactory(new EquinoxContextLogEntryFactory(Platform.getAdapterManager()));
+
+ timer.done();
+ }
+
+ private synchronized void checkJETBundleInstaller()
+ {
+ if(jetBundleInstaller == null) {
+ jetBundleInstaller = new JETBundleInstaller();
+ jetBundleInstaller.startup(bundleContext);
+ }
+ }
+
+ private synchronized void checkSavedStateManager()
+ {
+ if(savedStateManager == null) {
+ savedStateManager = new SavedStateManager(this);
+ savedStateManager.startup();
+ }
+ }
- pluginProjectMonitor = new PluginProjectMonitor();
- workspaceTagLibraryManager = new WorkspaceTagLibraryManager();
- workspaceTagLibraryManager.startup(pluginProjectMonitor);
- pluginProjectMonitor.startup();
+ private synchronized void checkWorkspaceTagLibraryManager()
+ {
+ if(workspaceTagLibraryManager == null) {
+ pluginProjectMonitor = new PluginProjectMonitor();
+ workspaceTagLibraryManager = new WorkspaceTagLibraryManager();
+ workspaceTagLibraryManager.startup(pluginProjectMonitor);
+ pluginProjectMonitor.startup();
+ }
+ }
- tagLibManager = new InternalTagLibManager();
- tagLibManager.startup();
+ private synchronized void checkBundleManager()
+ {
+ if(bundleManager == null) {
+ bundleManager = new JETBundleManager();
+ bundleManager.startup();
+ }
+ }
- jetBundleInstaller = new JETBundleInstaller();
- jetBundleInstaller.startup(context);
+ private synchronized void checkTagLibManager()
+ {
+ if(tagLibManager == null) {
+ tagLibManager = new InternalTagLibManager();
+ tagLibManager.startup();
+ }
+ }
- bundleManager = new JETBundleManager();
- bundleManager.startup();
-
- savedStateManager = new SavedStateManager(this);
- savedStateManager.startup();
-
- ContextLogEntryFactoryManager.setFactory(new EquinoxContextLogEntryFactory(Platform.getAdapterManager()));
+ private synchronized void checkXPathFunctionManager()
+ {
+ if(xpathFunctionsManager == null) {
+ // start the XPath function extensions early, they are used by other managers...
+ xpathFunctionsManager = new XPathFunctionsManager();
+ xpathFunctionsManager.startup();
+ }
}
/**
@@ -273,35 +378,59 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
* @param context the OSGi bundle context
* @throws Exception if the plugin cannot shutdown
*/
- public void stop(BundleContext context) throws Exception
+ public synchronized void stop(BundleContext context) throws Exception
{
- tagLibManager.shutdown();
- tagLibManager = null;
-
- jetBundleInstaller.shutdown();
- jetBundleInstaller = null;
-
- xpathFunctionsManager.shutdown();
- xpathFunctionsManager = null;
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "stop(BundleContext)"); //$NON-NLS-1$
- modelLoaderExtManager.shutdown();
- modelLoaderExtManager = null;
+ if(tagLibManager != null) {
+ tagLibManager.shutdown();
+ tagLibManager = null;
+ }
+
+ if(jetBundleInstaller != null) {
+ jetBundleInstaller.shutdown();
+ jetBundleInstaller = null;
+ }
- modelInspectorExtManager.shutdown();
- modelInspectorExtManager = null;
+ if(xpathFunctionsManager != null) {
+ xpathFunctionsManager.shutdown();
+ xpathFunctionsManager = null;
+ }
- bundleManager.shutdown();
- bundleManager = null;
+ if(modelLoaderExtManager != null) {
+ modelLoaderExtManager.shutdown();
+ modelLoaderExtManager = null;
+ }
+
+ if(modelInspectorExtManager != null) {
+ modelInspectorExtManager.shutdown();
+ modelInspectorExtManager = null;
+ }
- workspaceTagLibraryManager.shutdown();
- pluginProjectMonitor.shutdown();
+ if(bundleManager != null) {
+ bundleManager.shutdown();
+ bundleManager = null;
+ }
- savedStateManager.shutdown();
- savedStateManager = null;
+ if(workspaceTagLibraryManager != null) {
+ workspaceTagLibraryManager.shutdown();
+ workspaceTagLibraryManager = null;
+ }
+ if(pluginProjectMonitor != null) {
+ pluginProjectMonitor.shutdown();
+ pluginProjectMonitor = null;
+ }
+
+ if(savedStateManager != null) {
+ savedStateManager.shutdown();
+ savedStateManager = null;
+ }
// shut down the plug-in itself last
super.stop(context);
plugin = null;
+
+ timer.done();
}
/**
@@ -327,6 +456,8 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
public String[] getKnownTagLibraryIds()
{
+ checkTagLibManager();
+
return tagLibManager.getKnownTagLibraryIds();
}
@@ -335,6 +466,8 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public final XPathFunctionsManager getXPathFunctionsManager()
{
+ checkXPathFunctionManager();
+
return xpathFunctionsManager;
}
@@ -343,6 +476,8 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public final InternalTagLibManager getTagLibManager()
{
+ checkTagLibManager();
+
return tagLibManager;
}
@@ -351,11 +486,15 @@ public class InternalJET2Platform extends EMFPlugin.EclipsePlugin
*/
public final IJETBundleManager getBundleManager()
{
+ checkBundleManager();
+
return bundleManager;
}
public final SavedStateManager getSavedStateManager()
{
+ checkSavedStateManager();
+
return savedStateManager;
}
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/SavedStateManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/SavedStateManager.java
index 7d8c454..4c726a9 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/SavedStateManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/SavedStateManager.java
@@ -34,6 +34,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jet.internal.InternalJET2Platform.IMethodTimer;
/**
* Manager for state saved and restored by the jet plugin
@@ -266,6 +267,8 @@ public class SavedStateManager implements ISaveParticipant
public void startup()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "startup()"); //$NON-NLS-1$
+
if(DEBUG) System.out.println("SavedStateManager.startup()"); //$NON-NLS-1$
try
{
@@ -276,12 +279,18 @@ public class SavedStateManager implements ISaveParticipant
{
savedState = null;
}
+
+ timer.done();
}
public void shutdown()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "shutdown()"); //$NON-NLS-1$
+
if(DEBUG) System.out.println("SavedStateManager.shutdown()"); //$NON-NLS-1$
ResourcesPlugin.getWorkspace().removeSaveParticipant(plugin);
+
+ timer.done();
}
public IPath addSaveSaver(IStateSaver saver ,IProject project)
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/Messages.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/Messages.java
new file mode 100644
index 0000000..36a262b
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/Messages.java
@@ -0,0 +1,43 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: Messages.java,v 1.1.2.1 2008/09/09 18:09:04 pelder Exp $
+ */
+package org.eclipse.jet.internal.extensionpoints;
+
+
+import org.eclipse.osgi.util.NLS;
+
+
+public class Messages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.jet.internal.extensionpoints.messages"; //$NON-NLS-1$
+
+ public static String StaleXPathFunctionWrapper_DefiningPluginNotAvailable;
+
+ public static String UnableToLoadXPathFunctionWrapper_ErrorLoadingFunction;
+
+ public static String XPathFunctionLazyLoadWrapper_XPathFunctionNotImplemented;
+
+ public static String XPathFunctionNotImplementedWrapper_XPathFunctionNotImplemented;
+ static
+ {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelInspectorsManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelInspectorsManager.java
index d52553f..5f72b85 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelInspectorsManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelInspectorsManager.java
@@ -29,6 +29,8 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jet.internal.InternalJET2Platform;
+import org.eclipse.jet.internal.InternalJET2Platform.IMethodTimer;
import org.eclipse.jet.xpath.inspector.InspectorManager;
import org.osgi.framework.Bundle;
@@ -67,11 +69,15 @@ public final class ModelInspectorsManager implements IRegistryChangeListener
*/
public void startup()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "startup()"); //$NON-NLS-1$
+
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] configElements = reg.getConfigurationElementsFor(EXTENSION_POINT_ID);
addConfigElements(configElements);
reg.addRegistryChangeListener(this, PLUGIN_ID);
+
+ timer.done();
}
/**
@@ -101,10 +107,14 @@ public final class ModelInspectorsManager implements IRegistryChangeListener
*/
public void shutdown()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "shutdown()"); //$NON-NLS-1$
+
IExtensionRegistry reg = Platform.getExtensionRegistry();
reg.removeRegistryChangeListener(this);
tagLibraries.clear();
+
+ timer.done();
}
/**
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelLoaderExtManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelLoaderExtManager.java
index 52a0236..b64240a 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelLoaderExtManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/ModelLoaderExtManager.java
@@ -48,6 +48,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jet.internal.InternalJET2Platform;
import org.eclipse.jet.internal.JETActivatorWrapper;
+import org.eclipse.jet.internal.InternalJET2Platform.IMethodTimer;
import org.eclipse.jet.internal.l10n.JET2Messages;
import org.eclipse.jet.internal.runtime.model.EclipseExtensionLoaderFactory;
import org.eclipse.jet.runtime.model.ILoaderManager;
@@ -98,11 +99,15 @@ public final class ModelLoaderExtManager implements IRegistryChangeListener
*/
public void startup()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "startup()"); //$NON-NLS-1$
+
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] configElements = reg.getConfigurationElementsFor(EXTENSION_POINT_ID);
addConfigElements(configElements);
reg.addRegistryChangeListener(this, PLUGIN_ID);
+
+ timer.done();
}
/**
@@ -139,10 +144,14 @@ public final class ModelLoaderExtManager implements IRegistryChangeListener
*/
public void shutdown()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "shutdown()"); //$NON-NLS-1$
+
IExtensionRegistry reg = Platform.getExtensionRegistry();
reg.removeRegistryChangeListener(this);
tagLibraries.clear();
+
+ timer.done();
}
/**
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java
index 2531a9f..17165dd 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/PluginProjectMonitor.java
@@ -37,13 +37,14 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jet.CoreJETException;
import org.eclipse.jet.JET2Platform;
import org.eclipse.jet.internal.InternalJET2Platform;
import org.eclipse.jet.internal.JETActivatorWrapper;
+import org.eclipse.jet.internal.InternalJET2Platform.IMethodTimer;
import org.eclipse.jet.internal.runtime.BundleManifest;
import org.eclipse.jet.internal.runtime.JETBundleManager;
import org.eclipse.jet.internal.runtime.NotABundleException;
+import org.eclipse.jet.internal.runtime.model.XMLDOMLoader;
/**
* Monitor plugin projects in the workspace for changes in extension point definitions
@@ -177,6 +178,8 @@ public class PluginProjectMonitor implements IResourceChangeListener
public void startup()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "startup()"); //$NON-NLS-1$
+
if(DEBUG) System.out.println("PluginProjectMonitor.startup()"); //$NON-NLS-1$
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
@@ -189,6 +192,8 @@ public class PluginProjectMonitor implements IResourceChangeListener
}
}
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+
+ timer.done();
}
@@ -205,7 +210,7 @@ public class PluginProjectMonitor implements IResourceChangeListener
if(hasPluginManifest(project)) {
if(DEBUG)System.out.println(" has plugin.xml"); //$NON-NLS-1$
URL extensionsURL = new URL(projectURL, "plugin.xml"); //$NON-NLS-1$
- pluginDocumentRoot = JETActivatorWrapper.INSTANCE.getLoaderManager().getLoader(extensionsURL.toExternalForm(), "org.eclipse.jet.xml", "xml").load(extensionsURL); //$NON-NLS-1$ //$NON-NLS-2$
+ pluginDocumentRoot = new XMLDOMLoader().load(extensionsURL) ;
}
for (Iterator i = listeners.iterator(); i.hasNext();)
@@ -229,10 +234,6 @@ public class PluginProjectMonitor implements IResourceChangeListener
{
JETActivatorWrapper.INSTANCE.log(e);
}
- catch (CoreJETException e)
- {
- JETActivatorWrapper.INSTANCE.log(e);
- }
catch (NotABundleException e)
{
// arises when we find MANIFEST.MF that is not a OSGi bundle. In this case, we'll
@@ -242,9 +243,13 @@ public class PluginProjectMonitor implements IResourceChangeListener
public void shutdown()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "shutdown()"); //$NON-NLS-1$
+
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
listeners.clear();
+
+ timer.done();
}
public void addPluginProjectListener(IPluginChangeListener listener)
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/StaleXPathFunctionWrapper.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/StaleXPathFunctionWrapper.java
new file mode 100644
index 0000000..48f4c44
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/StaleXPathFunctionWrapper.java
@@ -0,0 +1,48 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: StaleXPathFunctionWrapper.java,v 1.1.2.1 2008/09/09 18:09:04 pelder Exp $
+ */
+package org.eclipse.jet.internal.extensionpoints;
+
+import java.util.List;
+
+import org.eclipse.jet.xpath.XPathFunction;
+import org.eclipse.jet.xpath.XPathRuntimeException;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Wrapper fro XPath functions whose plug-in information is stale and cannot be loaded
+ */
+public class StaleXPathFunctionWrapper implements XPathFunction
+{
+
+ private final String name;
+
+ public StaleXPathFunctionWrapper(String name)
+ {
+ this.name = name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.xpath.XPathFunction#evaluate(java.util.List)
+ */
+ public Object evaluate(List args)
+ {
+ throw new XPathRuntimeException(NLS.bind(
+ Messages.StaleXPathFunctionWrapper_DefiningPluginNotAvailable,
+ name));
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/UnableToLoadXPathFunctionWrapper.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/UnableToLoadXPathFunctionWrapper.java
new file mode 100644
index 0000000..1507fd4
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/UnableToLoadXPathFunctionWrapper.java
@@ -0,0 +1,51 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: UnableToLoadXPathFunctionWrapper.java,v 1.1.2.1 2008/09/09 18:09:04 pelder Exp $
+ */
+package org.eclipse.jet.internal.extensionpoints;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.jet.xpath.XPathFunction;
+import org.eclipse.jet.xpath.XPathRuntimeException;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Wrapper for XPath functions that could not be loaded
+ */
+public class UnableToLoadXPathFunctionWrapper implements XPathFunction
+{
+
+ private final String name;
+ private final String plugin;
+
+ public UnableToLoadXPathFunctionWrapper(String name, IConfigurationElement configElement)
+ {
+ this.name = name;
+ this.plugin = configElement.getContributor().getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.xpath.XPathFunction#evaluate(java.util.List)
+ */
+ public Object evaluate(List args)
+ {
+ throw new XPathRuntimeException(NLS.bind(
+ Messages.UnableToLoadXPathFunctionWrapper_ErrorLoadingFunction,
+ name, plugin));
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/WorkspaceTagLibraryManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/WorkspaceTagLibraryManager.java
index e77fb69..b603387 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/WorkspaceTagLibraryManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/WorkspaceTagLibraryManager.java
@@ -20,6 +20,8 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jet.internal.InternalJET2Platform;
+import org.eclipse.jet.internal.InternalJET2Platform.IMethodTimer;
import org.eclipse.jet.internal.runtime.BundleManifest;
import org.eclipse.jet.taglib.TagLibrary;
@@ -89,6 +91,9 @@ public class WorkspaceTagLibraryManager implements IPluginChangeListener
public void startup(PluginProjectMonitor projectMonitor)
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "startup()"); //$NON-NLS-1$
+
+
if(projectMonitor == null)
{
throw new NullPointerException();
@@ -99,15 +104,22 @@ public class WorkspaceTagLibraryManager implements IPluginChangeListener
}
this.projectMonitor = projectMonitor;
this.projectMonitor.addPluginProjectListener(this);
+
+ timer.done();
}
public void shutdown()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "shutdown()"); //$NON-NLS-1$
+
+
if (projectMonitor != null)
{
projectMonitor.removePluginProjectListener(this);
projectMonitor = null;
}
+
+ timer.done();
}
public TagLibrary getTagLibrary(String id)
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionLazyLoadWrapper.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionLazyLoadWrapper.java
new file mode 100644
index 0000000..5ee51f7
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionLazyLoadWrapper.java
@@ -0,0 +1,86 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: XPathFunctionLazyLoadWrapper.java,v 1.1.2.1 2008/09/09 18:09:04 pelder Exp $
+ */
+package org.eclipse.jet.internal.extensionpoints;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jet.internal.InternalJET2Platform;
+import org.eclipse.jet.xpath.XPathFunction;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author pelder
+ */
+public class XPathFunctionLazyLoadWrapper implements XPathFunction
+{
+
+ private final IConfigurationElement configElement;
+ private final String classAttributeName;
+ private final String name;
+
+ public XPathFunctionLazyLoadWrapper(String name, IConfigurationElement configElement, String classAttributeName)
+ {
+ this.name = name;
+ this.configElement = configElement;
+ this.classAttributeName = classAttributeName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.xpath.XPathFunction#evaluate(java.util.List)
+ */
+ public Object evaluate(List args)
+ {
+ throw new IllegalStateException();
+ }
+
+ public XPathFunction resolveFunction()
+ {
+ if(XPathFunctionsManager.DEBUG) {
+ System.out.println(NLS.bind("Resolving function {0}", name)); //$NON-NLS-1$
+ }
+ try
+ {
+ Object function = configElement.createExecutableExtension(classAttributeName);
+ if(function instanceof XPathFunction) {
+ return (XPathFunction)function;
+ } else {
+ InternalJET2Platform.log(new Status(IStatus.ERROR, configElement.getContributor().getName(),
+ NLS.bind(Messages.XPathFunctionLazyLoadWrapper_XPathFunctionNotImplemented,
+ function.getClass().getName(), name)));
+ return new XPathFunctionNotImplementedWrapper(name,
+ configElement.getContributor().getName(),
+ function.getClass().getName());
+ }
+ }
+ catch (InvalidRegistryObjectException e)
+ {
+ InternalJET2Platform.getDefault().log(e);
+ return new StaleXPathFunctionWrapper(name);
+ }
+ catch (CoreException e)
+ {
+ InternalJET2Platform.getDefault().log(e);
+ return new UnableToLoadXPathFunctionWrapper(name, configElement);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionNotImplementedWrapper.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionNotImplementedWrapper.java
new file mode 100644
index 0000000..f367a4d
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionNotImplementedWrapper.java
@@ -0,0 +1,50 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: XPathFunctionNotImplementedWrapper.java,v 1.1.2.1 2008/09/09 18:09:04 pelder Exp $
+ */
+package org.eclipse.jet.internal.extensionpoints;
+
+import java.util.List;
+
+import org.eclipse.jet.xpath.XPathFunction;
+import org.eclipse.jet.xpath.XPathRuntimeException;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Wrapper for XPath function definition that does not implement org.eclipse.jet.xpath.XPathFunction
+ */
+public class XPathFunctionNotImplementedWrapper implements XPathFunction
+{
+
+ private final String functionClassName;
+ private String functionName;
+ private String pluginID;
+
+ public XPathFunctionNotImplementedWrapper(String functionName, String pluginID, String functionClassName)
+ {
+ this.functionClassName = functionClassName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.xpath.XPathFunction#evaluate(java.util.List)
+ */
+ public Object evaluate(List args)
+ {
+ throw new XPathRuntimeException(NLS.bind(
+ Messages.XPathFunctionNotImplementedWrapper_XPathFunctionNotImplemented,
+ new Object []{ functionName, pluginID, functionClassName }));
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionsManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionsManager.java
index ff763ae..4431594 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionsManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/XPathFunctionsManager.java
@@ -20,7 +20,6 @@ package org.eclipse.jet.internal.extensionpoints;
import java.util.HashMap;
import java.util.Map;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionDelta;
@@ -31,7 +30,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jet.internal.InternalJET2Platform;
-import org.eclipse.jet.xpath.XPathFunction;
+import org.eclipse.jet.internal.InternalJET2Platform.IMethodTimer;
import org.eclipse.jet.xpath.XPathFunctionMetaData;
@@ -42,7 +41,7 @@ import org.eclipse.jet.xpath.XPathFunctionMetaData;
public final class XPathFunctionsManager implements IRegistryChangeListener
{
- private static boolean DEBUG = InternalJET2Platform.getDefault().isDebugging()
+ public static boolean DEBUG = InternalJET2Platform.getDefault().isDebugging()
&& Boolean.valueOf(Platform.getDebugOption("org.eclipse.jet/debug/ext/xpathFunctions")).booleanValue(); //$NON-NLS-1$
private static final String PLUGIN_ID = "org.eclipse.jet"; //$NON-NLS-1$
@@ -91,34 +90,29 @@ public final class XPathFunctionsManager implements IRegistryChangeListener
*/
private XPathFunctionMetaData buildFunctionMetaData(IConfigurationElement configElement)
{
- String name = configElement.getAttribute(A_FUNCTION_NAME);
- XPathFunction impl;
- int minArgs;
- int maxArgs;
- XPathFunctionMetaData functionData = null;
try
{
- impl = (XPathFunction)configElement.createExecutableExtension(A_FUNCTION_IMPLEMENTATION);
- try {
- minArgs = Integer.parseInt(configElement.getAttribute(A_FUNCTION_MINARGS));
- maxArgs = Integer.parseInt(configElement.getAttribute(A_FUNCTION_MAXARGS));
- try {
- functionData = new XPathFunctionMetaData(
- name, configElement.getDeclaringExtension().getNamespace(), impl, minArgs, maxArgs);
- }
- catch (NullPointerException e)
- {
- InternalJET2Platform.log(InternalJET2Platform.newStatus(IStatus.ERROR, "", e)); //$NON-NLS-1$
- }
- catch (IllegalArgumentException e)
- {
- InternalJET2Platform.log(InternalJET2Platform.newStatus(IStatus.ERROR, "", e)); //$NON-NLS-1$
- }
- }
- catch (NumberFormatException e)
- {
- InternalJET2Platform.log(InternalJET2Platform.newStatus(IStatus.ERROR, "", e)); //$NON-NLS-1$
- }
+ final String name = configElement.getAttribute(A_FUNCTION_NAME);
+ final int minArgs = Integer.parseInt(configElement.getAttribute(A_FUNCTION_MINARGS));
+ final int maxArgs = Integer.parseInt(configElement.getAttribute(A_FUNCTION_MAXARGS));
+ return new XPathFunctionMetaData(
+ name, configElement.getContributor().getName(),
+ new XPathFunctionLazyLoadWrapper(name, configElement, A_FUNCTION_IMPLEMENTATION),
+ minArgs, maxArgs);
+ }
+ catch (NumberFormatException e)
+ {
+ InternalJET2Platform.log(InternalJET2Platform.newStatus(IStatus.ERROR, "", e)); //$NON-NLS-1$
+ }
+ catch (NullPointerException e)
+ {
+ // thrown by XPathFunctionMetaData constructor
+ InternalJET2Platform.log(InternalJET2Platform.newStatus(IStatus.ERROR, "", e)); //$NON-NLS-1$
+ }
+ catch (IllegalArgumentException e)
+ {
+ // thrown by XPathFunctionMetaData constructor
+ InternalJET2Platform.log(InternalJET2Platform.newStatus(IStatus.ERROR, "", e)); //$NON-NLS-1$
}
catch (InvalidRegistryObjectException e)
{
@@ -129,12 +123,8 @@ public final class XPathFunctionsManager implements IRegistryChangeListener
// just ignore this, we have a stale object. BTW, this shouldn't happen, but at least in 3.2M4
// it does (instead of InvalidRegistryObjectException being thrown.
}
- catch (CoreException e)
- {
- InternalJET2Platform.log(e.getStatus());
- }
- return functionData;
+ return null;
}
/**
@@ -148,7 +138,7 @@ public final class XPathFunctionsManager implements IRegistryChangeListener
for (int i = 0; i < deltas.length; i++)
{
IExtensionDelta id = deltas[i];
- System.out.println(" " + id.getExtension().getNamespace() + ": " + id.getExtensionPoint().getUniqueIdentifier() + " (" + (id.getKind() == IExtensionDelta.ADDED ? "added" : "removed") + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$
+ System.out.println(" " + id.getExtension().getContributor().getName() + ": " + id.getExtensionPoint().getUniqueIdentifier() + " (" + (id.getKind() == IExtensionDelta.ADDED ? "added" : "removed") + ")"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$
System.out.println(" matches = " + EXTENSION_POINT_ID.equals(id.getExtensionPoint().getUniqueIdentifier())); //$NON-NLS-1$
}
}
@@ -193,11 +183,15 @@ public final class XPathFunctionsManager implements IRegistryChangeListener
*/
public void shutdown()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "shutdown()"); //$NON-NLS-1$
+
if(DEBUG) System.out.println("shutting down XPath function manager"); //$NON-NLS-1$
IExtensionRegistry reg = Platform.getExtensionRegistry();
reg.removeRegistryChangeListener(this);
functionMap.clear();
+
+ timer.done();
}
@@ -207,6 +201,8 @@ public final class XPathFunctionsManager implements IRegistryChangeListener
*/
public void startup()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "startup()"); //$NON-NLS-1$
+
if(DEBUG) System.out.println("starting XPath function manager"); //$NON-NLS-1$
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] configElements = reg.getConfigurationElementsFor(EXTENSION_POINT_ID);
@@ -214,6 +210,8 @@ public final class XPathFunctionsManager implements IRegistryChangeListener
// reg.addRegistryChangeListener(this, EXTENSION_POINT_ID);
reg.addRegistryChangeListener(this, PLUGIN_ID);
+
+ timer.done();
}
/**
@@ -227,6 +225,7 @@ public final class XPathFunctionsManager implements IRegistryChangeListener
public void forceRefresh(String id)
{
+ if(DEBUG) System.out.println("XPathFunctionManager: forced refresh on " + id); //$NON-NLS-1$
final IExtension[] extensions = Platform.getExtensionRegistry().getExtensions(id);
for (int i = 0; i < extensions.length; i++)
{
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/messages.properties b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/messages.properties
new file mode 100644
index 0000000..9a5c6aa
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/extensionpoints/messages.properties
@@ -0,0 +1,4 @@
+StaleXPathFunctionWrapper_DefiningPluginNotAvailable=Function {0} cannot be executed because the plug-in defining it is not longer available.
+UnableToLoadXPathFunctionWrapper_ErrorLoadingFunction=The function {0} could not be executed because of an error loading it from the defining plug-in {1}. See the Error Log for details.
+XPathFunctionLazyLoadWrapper_XPathFunctionNotImplemented=The implementation class {0} of function {1} does not implement org.eclipse.jet.xpath.XPathFunction
+XPathFunctionNotImplementedWrapper_XPathFunctionNotImplemented=Function {0} cannot be invoked. The class {1} supplied by the plugin {2} does not implement org.eclipse.jet.xpath.XPathFunction
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/InternalTagLibManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/InternalTagLibManager.java
index dddb09d..58f2a41 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/InternalTagLibManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/InternalTagLibManager.java
@@ -28,6 +28,8 @@ import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jet.internal.InternalJET2Platform;
+import org.eclipse.jet.internal.InternalJET2Platform.IMethodTimer;
import org.eclipse.jet.internal.extensionpoints.TagLibraryDataFactory;
import org.eclipse.jet.taglib.TagLibrary;
@@ -65,11 +67,15 @@ public final class InternalTagLibManager implements IRegistryChangeListener
*/
public void startup()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "startup()"); //$NON-NLS-1$
+
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] configElements = reg.getConfigurationElementsFor(EXTENSION_POINT_ID);
addTagLibraries(configElements);
reg.addRegistryChangeListener(this, PLUGIN_ID);
+
+ timer.done();
}
/**
@@ -152,10 +158,14 @@ public final class InternalTagLibManager implements IRegistryChangeListener
*/
public void shutdown()
{
+ IMethodTimer timer = InternalJET2Platform.getStartupMethodTimer(getClass(), "shutdown()"); //$NON-NLS-1$
+
IExtensionRegistry reg = Platform.getExtensionRegistry();
reg.removeRegistryChangeListener(this);
tagLibraries.clear();
+
+ timer.done();
}
public org.eclipse.jet.taglib.TagLibrary getTagLibrary(String id)
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathFunctionMetaData.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathFunctionMetaData.java
index 64f0c17..6712289 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathFunctionMetaData.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/xpath/XPathFunctionMetaData.java
@@ -16,6 +16,8 @@
*/
package org.eclipse.jet.xpath;
+import org.eclipse.jet.internal.extensionpoints.XPathFunctionLazyLoadWrapper;
+
/**
* Invariant class that defines implementation details of XPath functions.
@@ -23,7 +25,7 @@ package org.eclipse.jet.xpath;
public final class XPathFunctionMetaData
{
- private final XPathFunction function;
+ private XPathFunction function;
private final int minArgs;
@@ -82,8 +84,12 @@ public final class XPathFunctionMetaData
* Return the function implementation
* @return Returns the function.
*/
- public XPathFunction getFunction()
+ public synchronized XPathFunction getFunction()
{
+ if(function instanceof XPathFunctionLazyLoadWrapper) {
+ XPathFunctionLazyLoadWrapper wrapper = (XPathFunctionLazyLoadWrapper)function;
+ function = wrapper.resolveFunction();
+ }
return function;
}

Back to the top