summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Stryker2013-01-08 03:44:56 (EST)
committerRob Stryker2013-04-24 10:50:31 (EDT)
commita527c8b389ec9e3a7dadf30ee33d3936051b78f2 (patch)
treeb8125202440dd82606ebd8da24a414e028d456a0
parent579e8015469cb366bf4acecde156c68fb5a109c2 (diff)
downloadwebtools.common-a527c8b389ec9e3a7dadf30ee33d3936051b78f2.zip
webtools.common-a527c8b389ec9e3a7dadf30ee33d3936051b78f2.tar.gz
webtools.common-a527c8b389ec9e3a7dadf30ee33d3936051b78f2.tar.bz2
changes to allow a global heirarchy participant registry
-rw-r--r--plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java2
-rw-r--r--plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipant.java74
-rw-r--r--plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipantProvider.java41
-rw-r--r--plugins/org.eclipse.wst.common.modulecore/plugin.xml7
-rw-r--r--plugins/org.eclipse.wst.common.modulecore/schema/heirarchyFlattenParticipant.exsd131
5 files changed, 254 insertions, 1 deletions
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java
index 7e9895f..1f982d6 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/WrappedRuntimeException.java
@@ -78,7 +78,7 @@ public class WrappedRuntimeException extends RuntimeException implements IWrappe
* @return The nested exception held by the receiver.
*/
@Override
- public java.lang.Throwable getCause() {
+ public synchronized java.lang.Throwable getCause() {
return getNestedException();
}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipant.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipant.java
new file mode 100644
index 0000000..e1b360c
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipant.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Red Hat 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:
+ * Red Hat - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.common.componentcore.internal.flat;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.wst.common.componentcore.internal.ModulecorePlugin;
+import org.eclipse.wst.common.componentcore.internal.flat.FlatVirtualComponent.FlatComponentTaskModel;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+/**
+ * This class will make use of the heirarchyFlattenParticipant extension point
+ * to discover all globally-registered heirarchy participants and provide them
+ * in one clean participant. This allows a project / module (such as an EAR project)
+ * to accept child module nestings it may otherwise be unable to know about.
+ */
+public class GlobalHeirarchyParticipant extends AbstractFlattenParticipant {
+ private ArrayList<IFlattenParticipant> list = new ArrayList<IFlattenParticipant>();
+
+ @Override
+ public boolean isChildModule(IVirtualComponent rootComponent,
+ IVirtualReference reference, FlatComponentTaskModel dataModel) {
+ ensureLoaded();
+ Iterator<IFlattenParticipant> it = list.iterator();
+ while(it.hasNext() ) {
+ if( it.next().isChildModule(rootComponent, reference, dataModel))
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isChildModule(IVirtualComponent rootComponent, FlatComponentTaskModel dataModel, IFlatFile file) {
+ ensureLoaded();
+ Iterator<IFlattenParticipant> it = list.iterator();
+ while(it.hasNext() ) {
+ if( it.next().isChildModule(rootComponent, dataModel, file))
+ return true;
+ }
+ return false;
+ }
+
+ private void ensureLoaded() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf2 = registry.getConfigurationElementsFor(ModulecorePlugin.PLUGIN_ID, "heirarchyFlattenParticipant"); //$NON-NLS-1$
+ for( int i = 0; i < cf2.length; i++ ) {
+ try {
+ IFlattenParticipant o = (IFlattenParticipant)cf2[i].createExecutableExtension("class");
+ if( o != null )
+ list.add(o);
+ else {
+ // TODO log a warning
+ }
+ } catch(CoreException ce) {
+ // TODO log a warning
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipantProvider.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipantProvider.java
new file mode 100644
index 0000000..cb8b1d6
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/flat/GlobalHeirarchyParticipantProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Red Hat 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:
+ * Red Hat - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.common.componentcore.internal.flat;
+
+import java.util.Properties;
+
+/**
+ * This participant provider may be accessed by any module-core project
+ * making use of the flat virtual component model.
+ *
+ * It may be directly from a FlatComponentDeployable via
+ * FlatComponentDepoyable.getParticipantIds() by adding
+ * GlobalHeirarchyParticipantProvider.GLOBAL_HEIRARCHY_PARTICIPANT
+ * as one such id.
+ *
+ * For modules which prefer to customize the behavior based on whether
+ * the flatten task is being called from a publish or from an export,
+ * they may use their own IFlattenParticipantProvider to return
+ * a GlobalHeirarchyParticipant directly.
+ *
+ */
+public class GlobalHeirarchyParticipantProvider implements
+ IFlattenParticipantProvider {
+ public static final String GLOBAL_HEIRARCHY_PARTICIPANT = "globalHeirarchyParticipant";
+
+ public IFlattenParticipant findParticipant(String id, Properties properties) {
+ if( GLOBAL_HEIRARCHY_PARTICIPANT.equals(id)) {
+ return new GlobalHeirarchyParticipant();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.common.modulecore/plugin.xml b/plugins/org.eclipse.wst.common.modulecore/plugin.xml
index 26f7e5e..79b7fe0 100644
--- a/plugins/org.eclipse.wst.common.modulecore/plugin.xml
+++ b/plugins/org.eclipse.wst.common.modulecore/plugin.xml
@@ -57,6 +57,7 @@
<extension-point id="resourceFactories" name="Resource Factory Association (Internal)" schema="schema/resourceFactories.exsd"/>
<extension-point id="referenceResolver" name="referenceResolver" schema="schema/referenceResolver.exsd"/>
<extension-point id="flattenParticipantProvider" name="flattenParticipantProvider" schema="schema/flattenParticipantProvider.exsd"/>
+ <extension-point id="heirarchyFlattenParticipant" name="heirarchyFlattenParticipant" schema="schema/heirarchyFlattenParticipant.exsd"/>
<!-- Contribute a URIResolverExtension for flexible projects -->
<extension point="org.eclipse.wst.common.uriresolver.resolverExtensions">
@@ -82,6 +83,12 @@
<nature
id="org.eclipse.wst.common.modulecore.ModuleCoreNature">
</nature>
+ </extension>
+ <extension
+ point="org.eclipse.wst.common.modulecore.flattenParticipantProvider">
+ <flattenParticipantProvider
+ class="org.eclipse.wst.common.componentcore.internal.flat.GlobalHeirarchyParticipantProvider">
+ </flattenParticipantProvider>
</extension>
diff --git a/plugins/org.eclipse.wst.common.modulecore/schema/heirarchyFlattenParticipant.exsd b/plugins/org.eclipse.wst.common.modulecore/schema/heirarchyFlattenParticipant.exsd
new file mode 100644
index 0000000..38f4232
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.modulecore/schema/heirarchyFlattenParticipant.exsd
@@ -0,0 +1,131 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.wst.common.modulecore" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.wst.common.modulecore" id="heirarchyFlattenParticipant" name="heirarchyFlattenParticipant"/>
+ </appInfo>
+ <documentation>
+ This extension point is to register a global level flatten participant
+ which can be trusted to know about any and all approved nestings of various
+ project types, specifically regarding child modules.
+
+ By registering a heirarchyParticipant via this extension point, you can allow
+ your custom project / module type to be recognized as a child of another module type.
+ For example, your custom "car" archive project can be recognized as a child
+ module of an ear project or web project.
+
+ Parent modules and module delegates using a GlobalHeirarchyParticipant
+ or its provider are accepting that some potentially unknown module types
+ may declare themselves to be child modules of the parent module. Risk
+ is limited, however, as all that will change is whether a child component
+ is marked as a child or not. This will have some effect on the publish or export
+ events, however, as children modules will have their list of participants
+ used when a component is marked as a child module. If it is not marked as a child module,
+ the referenced component will instead be traversed normally.
+
+ As an example, if an unknown "car" project is referenced inside an ear project,
+ and if the "car" project is recognized as a child module, the "Car" project will
+ have its participants assist in the publish
+ (ex, ignoring .java files, optimizing itself according to logic consistent with the "car" project).
+
+ If the car project is NOT recognized as a child, the nested files
+ will be traversed simply as a tree, and features such as including
+ .class files instead of .java files will not take place.
+
+ Parent modules that require complete control over which virtual components
+ may be recognized as children should not allow their deployables to use the
+ GlobalHeirarchyParticipant at all.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="heirarchyParticipant"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="heirarchyParticipant">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.wst.common.componentcore.internal.flat.IFlattenParticipant"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ This extension point is provisional API and may change in the future.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>