Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgkessler2010-04-13 18:11:56 +0000
committergkessler2010-04-13 18:11:56 +0000
commit47d4b90fd2c2721aff8cd9a063364d1dd09fc425 (patch)
tree1c0ae04c3d7acd9164d3f845dd67749f682080f2
parent6c27c1e6fbf6b597b567ae8f6a72c6a9619bb849 (diff)
downloadwebtools.jsf-47d4b90fd2c2721aff8cd9a063364d1dd09fc425.tar.gz
webtools.jsf-47d4b90fd2c2721aff8cd9a063364d1dd09fc425.tar.xz
webtools.jsf-47d4b90fd2c2721aff8cd9a063364d1dd09fc425.zip
[308419] Allow adopters to extend and improve the JSFAppConfigManager
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java38
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractTestableExtensibleDefaultProviderSelectionStrategy.java114
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableProjectFactoryStrategy.java37
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/META-INF/MANIFEST.MF1
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml3
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigLocatorProviderFactory.exsd102
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigManagerFactory.exsd102
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java72
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java17
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java812
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManager.java505
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManagerProviderStrategy.java16
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/CompositeJSFAppConfigLocatorProviderStrategy.java115
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigLocatorProviderStrategy.java56
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigManagerProviderStrategy.java28
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/ExtensionBasedJSFAppConfigManagerProviderStrategy.java53
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigLocatorProvider.java16
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManager.java279
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManagerFactory.java18
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigLocatorProviderStrategy.java16
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigManagerFactory.java104
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/TestableJSFAppConfigManagerProviderStrategy.java21
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java13
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java33
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java5
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java20
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java14
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java30
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java28
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/AttributeValueResolverRegistryReader.java24
38 files changed, 1807 insertions, 911 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java
index b694df572..d65643be9 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/pde/AbstractSimpleClassExtensionRegistryReader.java
@@ -31,6 +31,8 @@ public abstract class AbstractSimpleClassExtensionRegistryReader<T> extends
private final String _configElementName;
private final Comparator<SortableExecutableExtension<T>> _comparator;
+ private boolean _logWarnings = false;
+
/**
* @param extPtNamespace
* @param extPtId
@@ -96,7 +98,7 @@ public abstract class AbstractSimpleClassExtensionRegistryReader<T> extends
{
Collections.sort(result, _comparator);
}
- } else
+ } else if (_logWarnings)
{
JSFCommonPlugin.log(IStatus.WARNING, String.format(
"No extensions found for: %s.%s", //$NON-NLS-1$
@@ -120,6 +122,13 @@ public abstract class AbstractSimpleClassExtensionRegistryReader<T> extends
protected abstract void handleLoadFailure(final CoreException ce);
/**
+ * @param doLogWarnings
+ */
+ protected void logWarnings(final boolean doLogWarnings) {
+ _logWarnings = doLogWarnings;
+ }
+
+ /**
* A comparator that sorts canonically by extension namespace and id, but
* can make exceptions for certain prefices.
*
@@ -157,6 +166,33 @@ public abstract class AbstractSimpleClassExtensionRegistryReader<T> extends
}
/**
+ * Ensures that contributions from "org.eclipse.jst" plugins are sorted last
+ *
+ * @param <T>
+ */
+ public static class CompareOrgEclipseJstContributorsLastComparator<T> extends CanonicalComparatorWithPrefixExceptions<T> {
+ @Override
+ protected int prefixSort(
+ SortableExecutableExtension<T> o1,
+ SortableExecutableExtension<T> o2)
+ {
+ // if o1 is contributed by open source, sort it
+ // after
+ if (o1.getContributorId().startsWith("org.eclipse.jst")) //$NON-NLS-1$
+ {
+ return 1;
+ }
+ // if o2 is contributed by open source, sort o1 first
+ else if (o2.getContributorId().startsWith("org.eclipse.jst")) //$NON-NLS-1$
+ {
+ return -1;
+ }
+ // otherwise, we don't care
+ return 0;
+ }
+
+ }
+ /**
* Used to sort extensions before locking down the list.
*
* @param <T>
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractTestableExtensibleDefaultProviderSelectionStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractTestableExtensibleDefaultProviderSelectionStrategy.java
new file mode 100644
index 000000000..028da9766
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/AbstractTestableExtensibleDefaultProviderSelectionStrategy.java
@@ -0,0 +1,114 @@
+package org.eclipse.jst.jsf.common.internal.strategy;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jst.jsf.common.internal.policy.IdentifierOrderedIteratorPolicy;
+
+/**
+ * Will select in order the testable, then extension-point, then default strategies.
+ * <p>
+ * Users should use addTestableStrategy(), addExtensionStrategy(), and addDefaultStrategy() and <b>NOT</b> addStrategy()
+ * <p>
+ * Users must supply a defaultStrategy at minimum;
+ * <p>
+ * @param <INPUT>
+ * @param <OUTPUT>
+ */
+public abstract class AbstractTestableExtensibleDefaultProviderSelectionStrategy<INPUT, OUTPUT>
+ extends
+ IteratorPolicyBasedStrategyComposite<INPUT, OUTPUT, OUTPUT, String, IIdentifiableStrategy<INPUT, OUTPUT, String>> {
+
+ private static final String TEST_STRATEGY_ID = "testInjection"; //$NON-NLS-1$
+ /**
+ * LocatorProviderStrategy id for extension-pt
+ */
+ private static final String EXT_PT_STRATEGY_ID = "extensionPointInjection"; //$NON-NLS-1$
+ /**
+ * LocatorProviderStrategy id for platform default
+ */
+ private static final String DEFAULT_STRATEGY_ID = "platformDefault"; //$NON-NLS-1$
+
+ /**
+ * Contructor
+ */
+ protected AbstractTestableExtensibleDefaultProviderSelectionStrategy() {
+ super(new MyIteratorPolicy());
+ }
+
+ @Override
+ public OUTPUT getNoResult() {
+ return null;
+ }
+
+ /**
+ * @param testStrategy
+ */
+ public void addTestableStrategy(final ISimpleStrategy<INPUT, OUTPUT> testStrategy) {
+ super.addStrategy(new IdententifiableStrategyWrapper(testStrategy, TEST_STRATEGY_ID));
+ }
+
+ /**
+ * @param extensionStrategy
+ */
+ public void addExtensionStrategy(final ISimpleStrategy<INPUT, OUTPUT> extensionStrategy) {
+ super.addStrategy(new IdententifiableStrategyWrapper(extensionStrategy, EXT_PT_STRATEGY_ID));
+ }
+
+ /**
+ * @param defaultStrategy
+ */
+ public void addDefaultStrategy(final ISimpleStrategy<INPUT, OUTPUT> defaultStrategy) {
+ super.addStrategy(new IdententifiableStrategyWrapper(defaultStrategy, DEFAULT_STRATEGY_ID));
+ }
+
+ private class IdententifiableStrategyWrapper<INPUT, OUTPUT, String> implements IIdentifiableStrategy<INPUT, OUTPUT, String> {
+
+ private ISimpleStrategy<INPUT, OUTPUT> _innerStrategy;
+ private String _id;
+
+ IdententifiableStrategyWrapper(final ISimpleStrategy<INPUT, OUTPUT> innerStrategy, final String id) {
+ _innerStrategy = innerStrategy;
+ _id = id;
+ }
+
+ public OUTPUT perform(INPUT input) throws Exception {
+ return _innerStrategy.perform(input);
+ }
+
+ public OUTPUT getNoResult() {
+ return null;
+ }
+
+ public String getId() {
+ return _id;
+ }
+
+ public java.lang.String getDisplayName() {
+ return null;
+ }
+
+ }
+ private static class MyIteratorPolicy extends
+ IdentifierOrderedIteratorPolicy<String> {
+
+ private static List<String> _selectionOrder;
+
+ static {
+ _selectionOrder = new ArrayList<String>();
+ _selectionOrder
+ .add(TEST_STRATEGY_ID);
+ _selectionOrder
+ .add(EXT_PT_STRATEGY_ID);
+ _selectionOrder
+ .add(DEFAULT_STRATEGY_ID);
+ }
+
+ public MyIteratorPolicy() {
+ super(_selectionOrder);
+ setExcludeNonExplicitValues(true);
+ }
+
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableProjectFactoryStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableProjectFactoryStrategy.java
new file mode 100644
index 000000000..7028bf74d
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/internal/strategy/TestableProjectFactoryStrategy.java
@@ -0,0 +1,37 @@
+package org.eclipse.jst.jsf.common.internal.strategy;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.QualifiedName;
+
+
+/**
+ * Abstract class that, when given a project session key,
+ * will provide the instance of OUTPUT to use, or no result
+ * <p>
+ * Users need only set the project session property with the key and OUTPUT instance
+ * @param <OUTPUT>
+ */
+public abstract class TestableProjectFactoryStrategy<OUTPUT> implements ISimpleStrategy<IProject, OUTPUT> {
+ private QualifiedName _key;
+
+ /**
+ * @param testableFactorySessionKey - project property session key for property value holding testable instance
+ */
+ public TestableProjectFactoryStrategy(final QualifiedName testableFactorySessionKey) {
+ _key = testableFactorySessionKey;
+ }
+
+ public OUTPUT perform(final IProject project) throws Exception {
+ if (_key != null && project != null) {
+ final Object factory = project.getSessionProperties().get(_key);
+ if (factory != null)
+ return (OUTPUT)factory;
+ }
+ return getNoResult();
+ }
+
+ public OUTPUT getNoResult() {
+ return null;
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/META-INF/MANIFEST.MF b/jsf/plugins/org.eclipse.jst.jsf.core/META-INF/MANIFEST.MF
index 25f4f56fe..95d3977d5 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/META-INF/MANIFEST.MF
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/META-INF/MANIFEST.MF
@@ -58,6 +58,7 @@ Export-Package: org.eclipse.jst.jsf.core,
org.eclipse.jst.jsf.core.internal.region;x-internal:=true,
org.eclipse.jst.jsf.core.internal.tld;x-friends:="org.eclipse.jst.pagedesigner,org.eclipse.jst.jsf.core.tests",
org.eclipse.jst.jsf.core.jsfappconfig,
+ org.eclipse.jst.jsf.core.jsfappconfig.internal;x-internal:=true,
org.eclipse.jst.jsf.core.jsflibraryconfiguration,
org.eclipse.jst.jsf.core.jsflibraryconfiguration.internal;x-friends:="org.eclipse.jst.jsf.core.tests",
org.eclipse.jst.jsf.core.jsflibraryregistry,
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties
index dc4c9ac17..eef52d12d 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.properties
@@ -51,5 +51,7 @@ noOpLibraryProviderMessage = This facet requires JSF implementation library to b
extension-point.name.12 = Symbol Context Resolver Factory Delegate
extension-point.name.13 = Tag Registry Factory
+extension-point.name.14 = JSF AppConfig Locator Provider Factory (internal)
+extension-point.name.15 = JSF AppConfig Manager Factory (internal)
Facelet.name=Facelet
FaceletComposite.name=Facelet Composite Component \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml
index 4af8e2f39..44692f0b3 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/plugin.xml
@@ -15,7 +15,8 @@
<extension-point id="jsfFacetConfiguration" name="%extension-point.name.11" schema="schema/jsfFacetConfiguration.exsd"/>
<extension-point id="symbolContextResolverFactory" name="%extension-point.name.12" schema="schema/symbolContextResolverFactory.exsd"/>
<extension-point id="tagRegistryFactory" name="%extension-point.name.13" schema="schema/tagRegistryFactory.exsd"/>
-
+ <extension-point id="jsfAppConfigLocatorProviderFactory" name="%extension-point.name.14" schema="schema/jsfAppConfigLocatorProviderFactory.exsd"/>
+ <extension-point id="jsfAppConfigManagerFactory" name="%extension-point.name.15" schema="schema/jsfAppConfigManagerFactory.exsd"/>
<extension point="org.eclipse.emf.ecore.generated_package">
<package
uri = "http://org.eclipse.jst.jsf.core/constraints.ecore"
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigLocatorProviderFactory.exsd b/jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigLocatorProviderFactory.exsd
new file mode 100644
index 000000000..83a247eda
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigLocatorProviderFactory.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.jsf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.jsf.core" id="jsfAppConfigLocatorProviderFactory" name="jsfAppConfigLocatorProviderFactory"/>
+ </appInfo>
+ <documentation>
+ internal... not provisional API
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="locatorProvider" minOccurs="0" maxOccurs="unbounded"/>
+ </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="locatorProvider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigLocatorProvider"/>
+ </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>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigManagerFactory.exsd b/jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigManagerFactory.exsd
new file mode 100644
index 000000000..c263ee0fb
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/schema/jsfAppConfigManagerFactory.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jst.jsf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jst.jsf.core" id="jsfAppConfigManagerFactory" name="JSF App Config Manager Factory"/>
+ </appInfo>
+ <documentation>
+ internal... not provisional API
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="factory"/>
+ </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="factory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManagerFactory"/>
+ </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>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java
index f9f9ac35d..883ee514a 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/AbstractJSFAppConfigLocater.java
@@ -15,9 +15,11 @@ import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+
/**
* Abstract implementation of {@link IJSFAppConfigLocater} that provides common
- * locater functionality. {@link IJSFAppConfigLocater} implementations should
+ * locater functionality. {@link IJSFAppConfigLocater} implementations MUST
* extend this class or provide similar functionality.
*
* <p><b>Provisional API - subject to change</b></p>
@@ -28,43 +30,33 @@ public abstract class AbstractJSFAppConfigLocater implements IJSFAppConfigLocate
/**
* {@link JSFAppConfigManager} instance to which this locater belongs.
+ * @deprecated - DO NOT USE
*/
protected JSFAppConfigManager manager = null;
+
+ /**
+ * {@link IJSFAppConfigManager} instance to which this locater belongs.
+ */
+ private IJSFAppConfigManager _manager;
/**
* Set of known {@link IJSFAppConfigProvider} instances.
*/
protected Set configProviders = new LinkedHashSet();
-
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#setJSFAppConfigManager(org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager)
- */
- public void setJSFAppConfigManager(JSFAppConfigManager manager) {
- this.manager = manager;
+
+ public void setJSFAppConfigManager(final IJSFAppConfigManager manager) {
+ this._manager = manager;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#getJSFAppConfigManager()
- */
- public JSFAppConfigManager getJSFAppConfigManager() {
- return manager;
+
+ public IJSFAppConfigManager getJSFAppConfigManager() {
+ return _manager;
}
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#startLocating()
- */
public abstract void startLocating();
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#stopLocating()
- */
public abstract void stopLocating();
- /* (non-Javadoc)
- * @see org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater#getJSFAppConfigProviders()
- */
- public Set getJSFAppConfigProviders() {
+ public Set<IJSFAppConfigProvider> getJSFAppConfigProviders() {
return configProviders;
}
@@ -77,11 +69,11 @@ public abstract class AbstractJSFAppConfigLocater implements IJSFAppConfigLocate
* added.
* @return true if instance was added, else false.
*/
- protected boolean addConfigProvider(IJSFAppConfigProvider configProvider) {
- boolean added = configProviders.add(configProvider);
- if (added && manager != null) {
+ protected boolean addConfigProvider(final IJSFAppConfigProvider configProvider) {
+ final boolean added = configProviders.add(configProvider);
+ if (added && getJSFAppConfigManager() != null) {
configProvider.setJSFAppConfigLocater(this);
- manager.notifyJSFAppConfigProvidersChangeListeners(
+ getJSFAppConfigManager().notifyJSFAppConfigProvidersChangeListeners(
configProvider,
JSFAppConfigProvidersChangeEvent.ADDED);
}
@@ -97,13 +89,13 @@ public abstract class AbstractJSFAppConfigLocater implements IJSFAppConfigLocate
* removed.
* @return true if instance was removed, else false.
*/
- protected boolean removeConfigProvider(IJSFAppConfigProvider configProvider) {
+ protected boolean removeConfigProvider(final IJSFAppConfigProvider configProvider) {
if (configProvider != null) {
configProvider.releaseFacesConfigModel();
}
- boolean removed = configProviders.remove(configProvider);
- if (removed && manager != null) {
- manager.notifyJSFAppConfigProvidersChangeListeners(
+ final boolean removed = configProviders.remove(configProvider);
+ if (removed && getJSFAppConfigManager() != null) {
+ getJSFAppConfigManager().notifyJSFAppConfigProvidersChangeListeners(
configProvider,
JSFAppConfigProvidersChangeEvent.REMOVED);
}
@@ -122,13 +114,13 @@ public abstract class AbstractJSFAppConfigLocater implements IJSFAppConfigLocate
* @param newConfigProviders New set of {@link IJSFAppConfigProvider}
* instances.
*/
- protected void updateConfigProviders(Set newConfigProviders) {
+ protected void updateConfigProviders(final Set newConfigProviders) {
if (newConfigProviders != null) {
- LinkedHashSet oldConfigProviders = new LinkedHashSet();
+ final LinkedHashSet oldConfigProviders = new LinkedHashSet();
//iterate over existing set
- Iterator itConfigProviders = configProviders.iterator();
+ final Iterator itConfigProviders = configProviders.iterator();
while (itConfigProviders.hasNext()) {
- IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itConfigProviders.next();
+ final IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itConfigProviders.next();
//remove provider from new set if it is already in existing set
if (!newConfigProviders.remove(configProvider)) {
//stage removal of existing provider that is not in new set
@@ -136,16 +128,16 @@ public abstract class AbstractJSFAppConfigLocater implements IJSFAppConfigLocate
}
}
//remove providers that are not in new set from existing set
- Iterator itOldConfigProviders = oldConfigProviders.iterator();
+ final Iterator itOldConfigProviders = oldConfigProviders.iterator();
while (itOldConfigProviders.hasNext()) {
- IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itOldConfigProviders.next();
+ final IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itOldConfigProviders.next();
//call removeConfigProvider(...) method so manager's listeners are notified
removeConfigProvider(configProvider);
}
//add providers that are still in new set to existing set
- Iterator itNewConfigProviders = newConfigProviders.iterator();
+ final Iterator itNewConfigProviders = newConfigProviders.iterator();
while (itNewConfigProviders.hasNext()) {
- IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itNewConfigProviders.next();
+ final IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itNewConfigProviders.next();
//call addConfigProvider(...) method so manager's listeners are notified
addConfigProvider(configProvider);
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java
index d78b5c0b2..2ccf1485e 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/ContextParamSpecifiedJSFAppConfigLocater.java
@@ -153,7 +153,7 @@ public class ContextParamSpecifiedJSFAppConfigLocater extends WebContentRelative
* @see org.eclipse.jst.jsf.core.jsfappconfig.WebContentRelativeJSFAppConfigLocater#getFilenames()
*/
protected List getFilenames() {
- return JSFAppConfigUtils.getConfigFilesFromContextParam(manager.getProject());
+ return JSFAppConfigUtils.getConfigFilesFromContextParam(getJSFAppConfigManager().getProject());
}
/**
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java
index 415894c19..3e3f01492 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/DefaultJSFAppConfigLocater.java
@@ -133,7 +133,7 @@ public class DefaultJSFAppConfigLocater extends WebContentRelativeJSFAppConfigLo
*/
protected void initDefConfigPath() {
if (defConfigPath == null) {
- IProject project = manager.getProject();
+ IProject project = getJSFAppConfigManager().getProject();
if (project != null) {
IVirtualFolder webContentFolder = new DefaultVirtualComponentQuery().getWebContentFolder(project);
if (webContentFolder != null) {
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java
index f4536673e..c3a6d0a94 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigLocater.java
@@ -12,32 +12,35 @@ package org.eclipse.jst.jsf.core.jsfappconfig;
import java.util.Set;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+
/**
* IJSFAppConfigLocater is the interface that Objects capable of locating
* and providing JSF application configuration resources must implement.
*
* <p><b>Provisional API - subject to change</b></p>
*
+ * @noimplement - users must extend {@link AbstractJSFAppConfigLocater}
* @author Ian Trimble - Oracle
*/
public interface IJSFAppConfigLocater {
/**
- * Sets the {@link JSFAppConfigManager} instance to which this locater
+ * Sets the {@link IJSFAppConfigManager} instance to which this locater
* belongs.
*
- * @param manager {@link JSFAppConfigManager} instance to be set.
+ * @param manager {@link IJSFAppConfigManager} instance to be set.
*/
- public void setJSFAppConfigManager(JSFAppConfigManager manager);
+ public void setJSFAppConfigManager(IJSFAppConfigManager manager);
/**
- * Gets the {@link JSFAppConfigManager} instance to which this locater
+ * Gets the {@link IJSFAppConfigManager} instance to which this locater
* belongs.
*
- * @return {@link JSFAppConfigManager} instance to which this locater
+ * @return {@link IJSFAppConfigManager} instance to which this locater
* belongs.
*/
- public JSFAppConfigManager getJSFAppConfigManager();
+ public IJSFAppConfigManager getJSFAppConfigManager();
/**
* Starts locating JSF application configuration resources.
@@ -60,6 +63,6 @@ public interface IJSFAppConfigLocater {
*
* @return set of {@link IJSFAppConfigProvider} instances.
*/
- public Set getJSFAppConfigProviders();
+ public Set<IJSFAppConfigProvider> getJSFAppConfigProviders();
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java
index a351eaa4d..51bba21d0 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/IJSFAppConfigProvider.java
@@ -18,7 +18,9 @@ import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
*
* <p><b>Provisional API - subject to change</b></p>
*
+ * @noimplement - should use {@link AbstractJSFAppConfigProvider} or {@link ArtifactEditJSFAppConfigProvider} if that config can be modified
* @author Ian Trimble - Oracle
+ *
*/
public interface IJSFAppConfigProvider {
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java
index f2caf5608..223357b9a 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/JSFAppConfigManager.java
@@ -1,421 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2005 Oracle Corporation.
- * 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:
- * Ian Trimble - initial API and implementation
- *******************************************************************************/
package org.eclipse.jst.jsf.core.jsfappconfig;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.util.EContentAdapter;
-import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jst.jsf.common.internal.managedobject.ObjectManager.ManagedObjectException;
+import org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager;
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.AbstractJSFAppConfigManager;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
-import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyResolverType;
-import org.eclipse.jst.jsf.facesconfig.emf.VariableResolverType;
/**
- * JSFAppConfigManager provides an entry point to an entire JSF application
- * configuration, which is defined in one or more application configuration
- * resource files.
- *
- * <p><b>Provisional API - subject to change</b></p>
- *
- * @author Ian Trimble - Oracle
+ * Default JSF AppConfig Manager
+ * <p>
+ * Mostly represents a merged representation of the Faces Configuration that the runtime would see
+ * <p>
+ * @deprecated - Helios
*/
-public class JSFAppConfigManager implements IResourceChangeListener {
-
+public class JSFAppConfigManager
+ extends AbstractJSFAppConfigManager{
+
/**
- * Key that is used for the IProject instance's session property that
- * holds a JSFAppConfigManager instance.
+ * UNUSED - here only for compatibility with original
*/
public static final QualifiedName KEY_SESSIONPROPERTY =
new QualifiedName(JSFCorePlugin.PLUGIN_ID, "JSFAppConfigManager"); //$NON-NLS-1$
/**
- * IProject instance to which this JSFAppConfigManager instance is keyed.
- */
- protected IProject project = null;
-
- /**
- * Collection of {@link IJSFAppConfigLocater} instances.
- */
- protected List configLocaters = null;
-
- /**
- * Collection of {@link IJSFAppConfigProvidersChangeListener} instances.
- */
- protected List configProvidersChangeListeners = null;
-
- /**
- * Map of application configuration model EMF classes to
- * {@link IFacesConfigChangeListener} instances.
- */
- protected Map facesConfigChangeListeners = null;
-
- /**
- * Single {@link FacesConfigChangeAdapter} instance.
- */
- protected FacesConfigChangeAdapter facesConfigChangeAdapter = null;
-
- /**
- * Gets a JSFAppConfigManager instance that is keyed to the passed IProject
- * parameter. May return null if the project is not valid or if a
- * CoreException is thrown while attempting to get or set the instance as
- * a session property.
+ * Constructor
+ * @param project
*
- * @param project IProject instance to which the returned
- * JSFAppConfigManager instance is keyed.
- * @return JSFAppConfigManager instance, or null.
*/
- public static synchronized JSFAppConfigManager getInstance(IProject project) {
- JSFAppConfigManager manager = null;
- if (JSFAppConfigUtils.isValidJSFProject(project)) {
- manager = getFromSessionProperty(project);
- if (manager == null) {
- manager = new JSFAppConfigManager(project);
- }
- }
- return manager;
+ private JSFAppConfigManager(final IProject project) {
+ super(project);
}
- /**
- * Attempts to get a JSFAppConfigManager instance from a session property
- * of the passed IProject instance. Will return null if the session
- * property has not yet been set.
- *
- * @param project IProject instance from which to retrieve the
- * JSFAppConfigManager instance.
- * @return JSFAppConfigManager instance, or null.
- */
- protected static JSFAppConfigManager getFromSessionProperty(IProject project) {
- JSFAppConfigManager manager = null;
- try {
- Object obj = project.getSessionProperty(KEY_SESSIONPROPERTY);
- if (obj instanceof JSFAppConfigManager) {
- manager = (JSFAppConfigManager)obj;
- }
- } catch(CoreException ce) {
- //log error
- JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce);
- }
- return manager;
- }
-
- /**
- * Sets this JSFAppConfigManager instance as a session property of its
- * IProject instance.
- */
- protected void setAsSessionProperty() {
- if (project != null && project.isAccessible()) {
- try {
- project.setSessionProperty(KEY_SESSIONPROPERTY, this);
- } catch(CoreException ce) {
- //log error
- JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce);
- }
- }
- }
-
- /**
- * Unsets this JSFAppConfigManager instance as a session property of its
- * IProject instance.
- */
- protected void unsetAsSessionProperty() {
- if (project != null && project.isAccessible()) {
- try {
- project.setSessionProperty(KEY_SESSIONPROPERTY, null);
- } catch(CoreException ce) {
- //log error
- JSFCorePlugin.log(IStatus.ERROR, ce.getLocalizedMessage(), ce);
- }
- }
- }
-
- /**
- * Constructor is private to prevent direct instantiation; call
- * getInstance(IProject).
- *
- * @param project IProject instance to which the new JSFAppConfigManager
- * instance is keyed.
- */
- private JSFAppConfigManager(IProject project) {
- this.project = project;
- initialize();
- }
-
- /**
- * Gets this instance's IProject instance.
- *
- * @return This instance's IProject instance.
- */
- public IProject getProject() {
- return project;
- }
+ private static JSFAppConfigManagerFactory FACTORY = new JSFAppConfigManagerFactory();
+
/**
- * Initializes instance by:
- * <ul>
- * <li>creating facesConfigChangeListeners collection, </li>
- * <li>creating configProvidersChangeListeners collection, </li>
- * <li>creating and populating configLocaters collection, </li>
- * <li>invoking the startLocating() method on all configLocaters, </li>
- * <li>setting instance as a session property of the IProject instance, </li>
- * <li>adding a resource change listener to the workspace.</li>
- * </ul>
- */
- protected void initialize() {
- //create collections
- facesConfigChangeListeners = new HashMap();
- configProvidersChangeListeners = new ArrayList();
- configLocaters = new ArrayList();
- //populate initial set of locaters
- populateConfigLocaters();
- //instruct locaters to start locating
- startConfigLocaters();
- //set as session property of project
- setAsSessionProperty();
- //add resource change listener
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE);
- }
-
- /**
- * Populates configLocaters Set with "built-in" set of
- * {@link IJSFAppConfigLocater} implementations.
- */
- protected void populateConfigLocaters() {
- //implicit runtime-provided configuration
- IJSFAppConfigLocater implicitRuntimeConfigLocater = new ImplicitRuntimeJSFAppConfigLocater();
- implicitRuntimeConfigLocater.setJSFAppConfigManager(this);
- configLocaters.add(implicitRuntimeConfigLocater);
- //default ("/WEB-INF/faces-config.xml") locater
- IJSFAppConfigLocater defaultConfigLocater = new DefaultJSFAppConfigLocater();
- defaultConfigLocater.setJSFAppConfigManager(this);
- configLocaters.add(defaultConfigLocater);
- //web.xml context-parameter specified locater
- IJSFAppConfigLocater contextParamConfigLocater = new ContextParamSpecifiedJSFAppConfigLocater();
- contextParamConfigLocater.setJSFAppConfigManager(this);
- configLocaters.add(contextParamConfigLocater);
- //runtime classpath locater
- IJSFAppConfigLocater classpathConfigLocater = new RuntimeClasspathJSFAppConfigLocater();
- classpathConfigLocater.setJSFAppConfigManager(this);
- configLocaters.add(classpathConfigLocater);
- }
-
- /**
- * Instructs set of {@link IJSFAppConfigLocater} instances to start
- * locating JSF application configuration resources.
- */
- protected void startConfigLocaters() {
- Iterator itConfigLocaters = configLocaters.iterator();
- while (itConfigLocaters.hasNext()) {
- IJSFAppConfigLocater configLocater = (IJSFAppConfigLocater)itConfigLocaters.next();
- configLocater.startLocating();
- }
- }
-
- /**
- * Instructs set of {@link IJSFAppConfigLocater} instances to stop
- * locating JSF application configuration resources.
- */
- protected void stopConfigLocaters() {
- Iterator itConfigLocaters = configLocaters.iterator();
- while (itConfigLocaters.hasNext()) {
- IJSFAppConfigLocater configLocater = (IJSFAppConfigLocater)itConfigLocaters.next();
- configLocater.stopLocating();
- configLocater.dispose();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- if (event.getType() == IResourceChangeEvent.PRE_CLOSE
- || event.getType() == IResourceChangeEvent.PRE_DELETE) {
- // a project is closing - release and cleanup
- final IProject aProject = (IProject) event.getResource();
- if (aProject != null && aProject.equals(this.project)) {
- SafeRunnable.run(new ISafeRunnable() {
-
- public void handleException(Throwable exception) {
- JSFCorePlugin.log("Unexpected Program Error: disposing resources", exception); //$NON-NLS-1$
- }
-
- public void run() throws Exception {
- dispose();
- }
- });
-
- return;
- }
- }
-
- IResourceDelta delta = event.getDelta();
- if (delta != null && delta.getKind() == IResourceDelta.CHANGED) {
- IResourceDelta[] removedDeltas = delta.getAffectedChildren(IResourceDelta.REMOVED);
- if (removedDeltas.length == 1) {
- IResourceDelta removedDelta = removedDeltas[0];
- IResource removedResource = removedDelta.getResource();
- if (removedResource != null && removedResource == project) {
- IResourceDelta[] addedDeltas = delta.getAffectedChildren(IResourceDelta.ADDED);
- if (addedDeltas.length == 1) {
- IResourceDelta addedDelta = addedDeltas[0];
- IResource addedResource = addedDelta.getResource();
- if (addedResource instanceof IProject) {
- changeProject((IProject)addedResource);
- }
- }
- }
- }
- }
- }
-
- /**
- * Called to respond to a change in the IProject instance to which this
- * instance belongs. Changes the cached IProject instance, stops all config
- * locaters, starts all config locaters.
- *
- * @param newProject New IProject instance to which this manager belongs.
- */
- protected void changeProject(IProject newProject) {
- this.project = newProject;
- stopConfigLocaters();
- startConfigLocaters();
- }
-
- /**
- * Adds an instance of {@link IJSFAppConfigProvidersChangeListener}.
- *
- * @param listener An instance of {@link IJSFAppConfigProvidersChangeListener}.
- * @return true if added, else false.
- */
- public boolean addJSFAppConfigProvidersChangeListener(IJSFAppConfigProvidersChangeListener listener) {
- return configProvidersChangeListeners.add(listener);
- }
-
- /**
- * Removes an instance of {@link IJSFAppConfigProvidersChangeListener}.
- *
- * @param listener an instance of {@link IJSFAppConfigProvidersChangeListener}.
- * @return true if removed, else false.
- */
- public boolean removeJSFAppConfigProvidersChangeListener(IJSFAppConfigProvidersChangeListener listener) {
- return configProvidersChangeListeners.remove(listener);
- }
-
- /**
- * Notifies all {@link IJSFAppConfigProvidersChangeListener} instances of
- * a change in the Set of {@link IJSFAppConfigProvider} instances.
- *
- * @param configProvider {@link IJSFAppConfigProvider} instance that has
- * changed.
- * @param eventType Event type.
+ * @param project
+ * @return JSFAppConfigManager
+ * @deprecated
*/
- public void notifyJSFAppConfigProvidersChangeListeners(IJSFAppConfigProvider configProvider, int eventType) {
- JSFAppConfigProvidersChangeEvent event = new JSFAppConfigProvidersChangeEvent(configProvider, eventType);
- Iterator itListeners = configProvidersChangeListeners.iterator();
- while (itListeners.hasNext()) {
- IJSFAppConfigProvidersChangeListener listener =
- (IJSFAppConfigProvidersChangeListener)itListeners.next();
- listener.changedJSFAppConfigProviders(event);
- }
- }
-
- /**
- * Adds an instance of {@link IFacesConfigChangeListener}. <br>
- * <br>
- * <b>NOTE:</b> Calling this method will cause all application
- * configuration models to be loaded, to ensure that a
- * {@link FacesConfigChangeAdapter} has been added to each model.
- *
- * @param emfClass EMF class in which the listener is interested.
- * @param listener {@link IFacesConfigChangeListener} instance.
- * @return Previous {@link IFacesConfigChangeListener}, or null.
- */
- public Object addFacesConfigChangeListener(Class emfClass, IFacesConfigChangeListener listener) {
- /*
- * Get all models, which will ensure that each one has had a
- * FacesConfigChangeAdapter added to it.
- */
- getFacesConfigModels();
- return facesConfigChangeListeners.put(emfClass, listener);
- }
-
- /**
- * Removes an instance of {@link IFacesConfigChangeListener}.
- *
- * @param emfClass EMF class in which the listener was interested.
- * @return Removed {@link IFacesConfigChangeListener}, or null.
- */
- public Object removeFacesConfigChangeListener(Class emfClass) {
- return facesConfigChangeListeners.remove(emfClass);
- }
-
- /**
- * Notifies {@link IFacesConfigChangeListener} instances of model changes
- * in which they registered interest.
- *
- * @param notification EMF {@link Notification} instance that describes the
- * model change.
- */
- public void notifyFacesConfigChangeListeners(Notification notification) {
- Object emfFeature = notification.getFeature();
- if (emfFeature instanceof EStructuralFeature) {
- Class emfClass = ((EStructuralFeature)emfFeature).getEType().getInstanceClass();
- IFacesConfigChangeListener listener = (IFacesConfigChangeListener)facesConfigChangeListeners.get(emfClass);
- if (listener != null) {
- listener.notifyChanged(notification);
- }
+ public static JSFAppConfigManager getInstance(final IProject project) {
+ try {
+ return FACTORY.getInstance(project);
+ } catch (ManagedObjectException e) {
+ JSFCorePlugin.log(e, "Failed to get JSFAppConfigManager instance for "+project.getName()); //$NON-NLS-1$
}
+ return null;
}
-
+
/**
- * Gets all {@link IJSFAppConfigProvider} instances from all
- * {@link IJSFAppConfigLocater} instances.
- *
- * @return Set of all {@link IJSFAppConfigProvider} instances.
+ * @return Set of {@link IJSFAppConfigProvider}s
+ * @deprecated - SHOULD NOT USE
*/
public Set getJSFAppConfigProviders() {
- Set allConfigProviders = new LinkedHashSet();
- Iterator itConfigLocaters = configLocaters.iterator();
- while (itConfigLocaters.hasNext()) {
- IJSFAppConfigLocater configLocater = (IJSFAppConfigLocater)itConfigLocaters.next();
- allConfigProviders.addAll(configLocater.getJSFAppConfigProviders());
- }
- return allConfigProviders;
+ return super.getJSFAppConfigProviders();
}
/**
@@ -423,412 +68,75 @@ public class JSFAppConfigManager implements IResourceChangeListener {
* {@link IJSFAppConfigProvider} instances.
*
* @return List of all {@link FacesConfigType} instances.
+ * @deprecated - SHOULD NOT USE
*/
public List getFacesConfigModels() {
- List facesConfigModels = new ArrayList();
- Iterator itConfigProviders = getJSFAppConfigProviders().iterator();
- while (itConfigProviders.hasNext()) {
- IJSFAppConfigProvider configProvider = (IJSFAppConfigProvider)itConfigProviders.next();
- FacesConfigType facesConfig = configProvider.getFacesConfigModel();
- if (facesConfig != null) {
- facesConfigModels.add(facesConfig);
- }
- }
- return facesConfigModels;
+ return super.getFacesConfigModels();
}
- /**
- * Disposes of resources by:
- * <ul>
- * <li>removing a resource change listener to the workspace</li>
- * <li>removing instance as a session property of the IProject instance</li>
- * <li>invoking the stopLocating() method on all configLocaters</li>
- * <li>clearing the configLocaters collection</li>
- * <li>clearing the configProvidersChangeListeners collection</li>
- * <li>clearing the facesConfigChangeListeners collection</li>
- * </ul>
- */
- protected void dispose() {
- //remove resource change listener
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.removeResourceChangeListener(this);
- //remove session property from project
- unsetAsSessionProperty();
- //instruct locaters to stop locating
- stopConfigLocaters();
- //clear collections
- configLocaters.clear();
- configProvidersChangeListeners.clear();
- facesConfigChangeListeners.clear();
- }
-
- /**
- * Gets list of all ManagedBeanType instances from all known faces-config
- * models; list may be empty.
- *
- * @return List of all ManagedBeanType instances from all known
- * faces-config models (list may be empty).
- */
public List getManagedBeans() {
- List allManagedBeans = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList managedBeans = facesConfig.getManagedBean();
- allManagedBeans.addAll(managedBeans);
- }
- return allManagedBeans;
- }
-
- /**
- * @return List of all variable resolver class names registered.
- */
- public final List<String> getPropertyResolvers()
- {
- final List<String> allPropertyResolvers = new ArrayList<String>();
- final List applications = getApplications();
- final Iterator appIterator = applications.iterator();
- while (appIterator.hasNext())
- {
- final ApplicationType application = (ApplicationType) appIterator.next();
- for (final Iterator it = application.getPropertyResolver().iterator(); it.hasNext();)
- {
- final PropertyResolverType propRes = (PropertyResolverType) it.next();
- String propClass = propRes.getTextContent();
- if (propClass != null)
- {
- propClass = propClass.trim();
- if (!"".equals(propClass)) //$NON-NLS-1$
- {
- allPropertyResolvers.add(propClass);
- }
- }
- }
- }
- return allPropertyResolvers;
+ return super.getManagedBeans();
}
- /**
- * Gets list of all ValidatorType instances from all known faces-config
- * models; list may be empty.
- *
- * @return List of all ValidatorType instances from all known faces-config
- * models (list may be empty).
- */
public List getValidators() {
- List allValidators = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList validators = facesConfig.getValidator();
- allValidators.addAll(validators);
- }
- return allValidators;
+ return super.getValidators();
}
- /**
- * @return List of all variable resolver class names registered.
- */
- public final List<String> getVariableResolvers()
- {
- final List<String> allVariableResolvers = new ArrayList<String>();
- final List applications = getApplications();
- final Iterator appIterator = applications.iterator();
- while (appIterator.hasNext())
- {
- final ApplicationType application = (ApplicationType) appIterator.next();
- for (final Iterator it = application.getVariableResolver().iterator(); it.hasNext();)
- {
- final VariableResolverType varRes = (VariableResolverType) it.next();
- String varClass = varRes.getTextContent();
- if (varClass != null)
- {
- varClass = varClass.trim();
- if (!"".equals(varClass)) //$NON-NLS-1$
- {
- allVariableResolvers.add(varClass);
- }
- }
- }
- }
- return allVariableResolvers;
- }
-
- /**
- * Gets list of all ConverterType instances from all known faces-config
- * models; list may be empty.
- *
- * @return List of all ConverterType instances from all known faces-config
- * models (list may be empty).
- */
public List getConverters() {
- List allConverters = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList converters = facesConfig.getConverter();
- allConverters.addAll(converters);
- }
- return allConverters;
+ return super.getConverters();
}
- /**
- * Gets list of all NavigationRuleType instances from all known
- * faces-config models; list may be empty.
- *
- * @return List of all NavigationRuleType instances from all known
- * faces-config models (list may be empty).
- */
public List getNavigationRules() {
- List allNavigationRules = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList navigationRules = facesConfig.getNavigationRule();
- allNavigationRules.addAll(navigationRules);
- }
- return allNavigationRules;
+ return super.getNavigationRules();
}
- /**
- * Gets list of all NavigationRuleType instances from all known
- * faces-config models where the navigation-rule's from-view-id value
- * matches the web content folder-relative value of the passed IFile
- * instance; list may be empty. Matching is performed in the same manner
- * as for a JSF implementation's default NavigationHandler.
- *
- * @param pageFile IFile instance to match against the from-view-id value
- * of all NavigationRuleType instances. File is assumed to be relative to
- * the web content folder, but may be expressed in a more complete form;
- * its path will be calculated relative to the web content folder.
- * @return List of all NavigationRuleType instances from all known
- * faces-config models where the navigation-rule's from-view-id value
- * matches the web content folder-relative value of the passed IFile
- * instance (list may be empty).
- */
- public List getNavigationRulesForPage(IFile pageFile) {
- List navigationRulesForPage = new ArrayList();
- IPath pageFilePath = JSFAppConfigUtils.getWebContentFolderRelativePath(pageFile);
- if (pageFilePath != null) {
- String pageFileString = pageFilePath.toString();
- if (!pageFileString.startsWith("/")) { //$NON-NLS-1$
- pageFileString = "/" + pageFileString; //$NON-NLS-1$
- }
- List navigationRules = getNavigationRules();
- Iterator itNavigationRules = navigationRules.iterator();
- while (itNavigationRules.hasNext()) {
- NavigationRuleType navigationRule = (NavigationRuleType)itNavigationRules.next();
- FromViewIdType fromViewIdType = navigationRule.getFromViewId();
- if (fromViewIdType != null) {
- String fromViewId = fromViewIdType.getTextContent();
- if (fromViewId != null && fromViewId.length() > 0) {
- if (!fromViewId.equals("*")) { //$NON-NLS-1$
- if (fromViewId.equals(pageFileString)) {
- //exact match
- navigationRulesForPage.add(navigationRule);
- } else if (fromViewId.endsWith("*")) { //$NON-NLS-1$
- String prefixFromViewId = fromViewId.substring(0, fromViewId.length() - 1);
- if (pageFileString.startsWith(prefixFromViewId)) {
- //prefix match
- navigationRulesForPage.add(navigationRule);
- }
- }
- } else {
- //from-view-id == "*" - matches all pages
- navigationRulesForPage.add(navigationRule);
- }
- }
- } else {
- //no from-view-id element - matches all pages
- navigationRulesForPage.add(navigationRule);
- }
- }
- }
- return navigationRulesForPage;
+ public List getNavigationRulesForPage(final IFile pageFile) {
+ return super.getNavigationRulesForPage(pageFile);
}
- /**
- * Gets list of all ApplicationType instances from all known
- * faces-config models; list may be empty.
- *
- * @return List of all ApplicationType instances from all known
- * faces-config models (list may be empty).
- */
public List getApplications() {
- List allApplications = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList applications = facesConfig.getApplication();
- allApplications.addAll(applications);
- }
- return allApplications;
+ return super.getApplications();
}
- /**
- * Gets list of all FactoryType instances from all known faces-config
- * models; list may be empty.
- *
- * @return List of all FactoryType instances from all known faces-config
- * models (list may be empty).
- */
public List getFactories() {
- List allFactories = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList factories = facesConfig.getFactory();
- allFactories.addAll(factories);
- }
- return allFactories;
+ return super.getFactories();
}
- /**
- * Gets list of all ComponentType instances from all known faces-config
- * models; list may be empty.
- *
- * @return List of all ComponentType instances from all known faces-config
- * models (list may be empty).
- */
public List getComponents() {
- List allComponents = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList components = facesConfig.getComponent();
- allComponents.addAll(components);
- }
- return allComponents;
+ return super.getComponents();
}
- /**
- * Gets list of all ReferencedBeanType instances from all known
- * faces-config models; list may be empty.
- *
- * @return List of all ReferencedBeanType instances from all known
- * faces-config models (list may be empty).
- */
public List getReferencedBeans() {
- List allReferencedBeans = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList referencedBeans = facesConfig.getReferencedBean();
- allReferencedBeans.addAll(referencedBeans);
- }
- return allReferencedBeans;
+ return super.getReferencedBeans();
}
- /**
- * Gets list of all RenderKitType instances from all known faces-config
- * models; list may be empty.
- *
- * @return List of all RenderKitType instances from all known faces-config
- * models (list may be empty).
- */
public List getRenderKits() {
- List allRenderKits = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList renderKits = facesConfig.getRenderKit();
- allRenderKits.addAll(renderKits);
- }
- return allRenderKits;
+ return super.getRenderKits();
}
- /**
- * Gets list of all LifecycleType instances from all known faces-config
- * models; list may be empty.
- *
- * @return List of all LifecycleType instances from all known faces-config
- * models (list may be empty).
- */
public List getLifecycles() {
- List allLifecycles = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- EList lifecycles = facesConfig.getLifecycle();
- allLifecycles.addAll(lifecycles);
- }
- return allLifecycles;
+ return super.getLifecycles();
}
- /**
- * @return the list of all resource bundles declared in all the FacesConfig
- * configurations found.
- */
- public List getResourceBundles()
- {
- List allResourceBundles = new ArrayList();
- List facesConfigs = getFacesConfigModels();
- Iterator itFacesConfigs = facesConfigs.iterator();
- while (itFacesConfigs.hasNext()) {
- FacesConfigType facesConfig = (FacesConfigType)itFacesConfigs.next();
- for (final Iterator applicationIt = facesConfig.getApplication().iterator(); applicationIt.hasNext();)
- {
- ApplicationType appType = (ApplicationType) applicationIt.next();
- allResourceBundles.addAll(appType.getResourceBundle());
- }
- }
- return allResourceBundles;
- }
-
- /**
- * Adds this instance's {@link FacesConfigChangeAdapter} instance to the
- * passed application configuration model's adapters collection.
- *
- * @param facesConfig Application configuration model's root object.
- */
- public void addFacesConfigChangeAdapter(FacesConfigType facesConfig) {
- if (facesConfig != null) {
- if (facesConfigChangeAdapter == null) {
- facesConfigChangeAdapter = new FacesConfigChangeAdapter();
- }
- facesConfig.eAdapters().add(facesConfigChangeAdapter);
- }
+ public List getResourceBundles() {
+ return super.getResourceBundles();
+ }
+
+ public List getFacesConfigExtensions() {
+ return super.getFacesConfigExtensions();
}
- /**
- * Removes this instance's {@link FacesConfigChangeAdapter} instance from
- * the passed application configuration model's adapters collection.
- *
- * @param facesConfig Application configuration model's root object.
- */
- public void removeFacesConfigChangeAdapter(FacesConfigType facesConfig) {
- if (facesConfig != null && facesConfigChangeAdapter != null) {
- facesConfig.eAdapters().remove(facesConfigChangeAdapter);
+ private static class JSFAppConfigManagerFactory
+ extends ResourceSingletonObjectManager<JSFAppConfigManager, IProject> {
+
+ protected JSFAppConfigManagerFactory() {
+ super(ResourcesPlugin.getWorkspace());
}
- }
- /**
- * FacesConfigChangeAdapter is an EMF adapter which provides a mechanism
- * for notification of changes to features in any application configuration
- * model for which {@link IFacesConfigChangeListener} instances have
- * registered an interest.
- *
- * @author Ian Trimble - Oracle
- */
- class FacesConfigChangeAdapter extends EContentAdapter {
- /*
- * (non-Javadoc)
- * @see org.eclipse.emf.ecore.util.EContentAdapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
- */
- public void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- notifyFacesConfigChangeListeners(notification);
+ @Override
+ protected JSFAppConfigManager createNewInstance(final IProject project) {
+ return new JSFAppConfigManager(project);
}
+
}
-
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java
index 7cb04b06b..c8a6ce361 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/RuntimeClasspathJSFAppConfigLocater.java
@@ -61,7 +61,7 @@ public class RuntimeClasspathJSFAppConfigLocater extends AbstractJSFAppConfigLoc
*/
public void locateProviders() {
try {
- List JARs = JSFAppConfigUtils.getConfigFileJARsFromClasspath(manager.getProject());
+ List JARs = JSFAppConfigUtils.getConfigFileJARsFromClasspath(getJSFAppConfigManager().getProject());
Iterator itJARs = JARs.iterator();
Set newConfigProviders = new LinkedHashSet();
while (itJARs.hasNext()) {
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java
index 3f53e57a1..4b848a63d 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/WebContentRelativeJSFAppConfigLocater.java
@@ -40,7 +40,7 @@ public abstract class WebContentRelativeJSFAppConfigLocater extends AbstractJSFA
* updates the set of {@link IJSFAppConfigProvider} instances accordingly.
*/
public void locateProviders() {
- IProject project = manager.getProject();
+ IProject project = getJSFAppConfigManager().getProject();
IVirtualFolder webContentFolder = new DefaultVirtualComponentQuery().getWebContentFolder(project);
if (webContentFolder != null) {
List filenames = getFilenames();
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManager.java
new file mode 100644
index 000000000..26ac52551
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManager.java
@@ -0,0 +1,505 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.jst.jsf.common.internal.managedobject.AbstractManagedObject;
+import org.eclipse.jst.jsf.core.jsfappconfig.IFacesConfigChangeListener;
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater;
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider;
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvidersChangeListener;
+import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigProvidersChangeEvent;
+import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils;
+import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
+import org.eclipse.jst.jsf.facesconfig.emf.BehaviorType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigExtensionType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.LifecycleType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyResolverType;
+import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
+import org.eclipse.jst.jsf.facesconfig.emf.ResourceBundleType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
+import org.eclipse.jst.jsf.facesconfig.emf.VariableResolverType;
+
+/**
+ * Abstract JSFAppConfigManager that implementers of {@link IJSFAppConfigManager} MUST
+ * extend.
+ * <p>
+ * JSFAppConfigManager provides an entry point to an entire JSF application
+ * configuration, which is defined in one or more application configuration
+ * resource files.
+ */
+public abstract class AbstractJSFAppConfigManager
+ extends AbstractManagedObject
+ implements IJSFAppConfigManager {
+
+ /**
+ * The IProject
+ * @deprecated - use getProject()
+ */
+ protected IProject _project;
+
+ /**
+ * Collection of {@link IJSFAppConfigLocater} instances.
+ */
+ protected List<IJSFAppConfigLocater> configLocaters;
+
+ /**
+ * Collection of {@link IJSFAppConfigProvidersChangeListener} instances.
+ */
+ protected List<IJSFAppConfigProvidersChangeListener> configProvidersChangeListeners;
+
+ /**
+ * Map of application configuration model EMF classes to
+ * {@link IFacesConfigChangeListener} instances.
+ */
+ protected Map<Class, IFacesConfigChangeListener> facesConfigChangeListeners;
+
+ /**
+ * Single {@link FacesConfigChangeAdapter} instance.
+ */
+ protected FacesConfigChangeAdapter facesConfigChangeAdapter;
+
+ /**
+ * Constructor
+ * @param project
+ */
+ public AbstractJSFAppConfigManager(final IProject project) {
+ _project = project;
+ initialize();
+ }
+
+ public IProject getProject() {
+ return _project;
+ }
+
+ /**
+ * Initializes instance by:
+ * <ul>
+ * <li>creating facesConfigChangeListeners collection, </li>
+ * <li>creating configProvidersChangeListeners collection, </li>
+ * <li>creating and populating configLocaters collection, </li>
+ * <li>invoking the startLocating() method on all configLocaters, </li>
+ * </ul>
+ */
+ protected void initialize() {
+ //create collections
+ facesConfigChangeListeners = new HashMap<Class, IFacesConfigChangeListener>();
+ configProvidersChangeListeners = new ArrayList<IJSFAppConfigProvidersChangeListener>();
+ configLocaters = new ArrayList<IJSFAppConfigLocater>();
+ //populate initial set of locaters
+ populateConfigLocaters();
+ //instruct locaters to start locating
+ startConfigLocaters();
+ }
+
+ /**
+ * Populates configLocaters using @link IJSFAppConfigLocater} implementations
+ * from CompositeLocatorProviderStrategy
+ */
+ protected void populateConfigLocaters() {
+ final CompositeJSFAppConfigLocatorProviderStrategy clps = new CompositeJSFAppConfigLocatorProviderStrategy(this.getProject());
+ for (final IJSFAppConfigLocater locator : clps.getLocators()) {
+ locator.setJSFAppConfigManager(this);
+ configLocaters.add(locator);
+ }
+ }
+
+ /**
+ * Instructs set of {@link IJSFAppConfigLocater} instances to start
+ * locating JSF application configuration resources.
+ */
+ protected void startConfigLocaters() {
+ for (final IJSFAppConfigLocater configLocater : configLocaters) {
+ configLocater.startLocating();
+ }
+ }
+
+ /**
+ * Instructs set of {@link IJSFAppConfigLocater} instances to stop
+ * locating JSF application configuration resources.
+ */
+ protected void stopConfigLocaters() {
+ for (final IJSFAppConfigLocater configLocater : configLocaters) {
+ configLocater.stopLocating();
+ configLocater.dispose();
+ }
+ }
+
+ /**
+ * Called to respond to a change in the IProject instance to which this
+ * instance belongs. Changes the cached IProject instance, stops all config
+ * locaters, starts all config locaters.
+ *
+ * @param newProject New IProject instance to which this manager belongs.
+ * @deprecated - SHOULD NOT USE
+ */
+ protected void changeProject(final IProject newProject) {
+ _project = newProject;
+ stopConfigLocaters();
+ startConfigLocaters();
+ }
+
+ public boolean addJSFAppConfigProvidersChangeListener(final IJSFAppConfigProvidersChangeListener listener) {
+ return configProvidersChangeListeners.add(listener);
+ }
+
+ public boolean removeJSFAppConfigProvidersChangeListener(final IJSFAppConfigProvidersChangeListener listener) {
+ return configProvidersChangeListeners.remove(listener);
+ }
+
+ public void notifyJSFAppConfigProvidersChangeListeners(final IJSFAppConfigProvider configProvider, final int eventType) {
+ final JSFAppConfigProvidersChangeEvent event = new JSFAppConfigProvidersChangeEvent(configProvider, eventType);
+ for (final IJSFAppConfigProvidersChangeListener listener : configProvidersChangeListeners) {
+ listener.changedJSFAppConfigProviders(event);
+ }
+ }
+
+ public Object addFacesConfigChangeListener(Class emfClass, IFacesConfigChangeListener listener) {
+ /*
+ * Get all models, which will ensure that each one has had a
+ * FacesConfigChangeAdapter added to it (if the model is updateable).
+ */
+ getFacesConfigModels();
+ return facesConfigChangeListeners.put(emfClass, listener);
+ }
+
+ public Object removeFacesConfigChangeListener(Class emfClass) {
+ return facesConfigChangeListeners.remove(emfClass);
+ }
+
+ public void notifyFacesConfigChangeListeners(final Notification notification) {
+ final Object emfFeature = notification.getFeature();
+ if (emfFeature instanceof EStructuralFeature) {
+ final Class emfClass = ((EStructuralFeature)emfFeature).getEType().getInstanceClass();
+ final IFacesConfigChangeListener listener = facesConfigChangeListeners.get(emfClass);
+ if (listener != null) {
+ listener.notifyChanged(notification);
+ }
+ }
+ }
+
+ /**
+ * @return Set of {@link IJSFAppConfigProvider}s
+ */
+ protected Set<IJSFAppConfigProvider> getJSFAppConfigProviders() {
+ final Set<IJSFAppConfigProvider> allConfigProviders = new LinkedHashSet<IJSFAppConfigProvider>();
+ final Iterator itConfigLocaters = configLocaters.iterator();
+ while (itConfigLocaters.hasNext()) {
+ final IJSFAppConfigLocater configLocater = (IJSFAppConfigLocater)itConfigLocaters.next();
+ allConfigProviders.addAll(configLocater.getJSFAppConfigProviders());
+ }
+ return allConfigProviders;
+ }
+
+ /**
+ * Gets all {@link FacesConfigType} instances from all
+ * {@link IJSFAppConfigProvider} instances.
+ *
+ * @return List of all {@link FacesConfigType} instances.
+ */
+ protected List<FacesConfigType> getFacesConfigModels() {
+ final List<FacesConfigType> facesConfigModels = new ArrayList<FacesConfigType>();
+ for(final IJSFAppConfigProvider configProvider : getJSFAppConfigProviders()) {
+ final FacesConfigType facesConfig = configProvider.getFacesConfigModel();
+ if (facesConfig != null) {
+ facesConfigModels.add(facesConfig);
+ }
+ }
+ return facesConfigModels;
+ }
+
+//----------------------- IManagedObject lifecycle methods ----------------------------//
+ /**
+ * Disposes of resources by:
+ * <ul>
+ * <li>removing a resource change listener to the workspace</li>
+ * <li>removing instance as a session property of the IProject instance</li>
+ * <li>invoking the stopLocating() method on all configLocaters</li>
+ * <li>clearing the configLocaters collection</li>
+ * <li>clearing the configProvidersChangeListeners collection</li>
+ * <li>clearing the facesConfigChangeListeners collection</li>
+ * </ul>
+ */
+ public void dispose() {
+ //instruct locaters to stop locating
+ stopConfigLocaters();
+ //clear collections
+ configLocaters.clear();
+ configProvidersChangeListeners.clear();
+ facesConfigChangeListeners.clear();
+ }
+
+ public void destroy() {
+ //
+ }
+
+ public void checkpoint() {
+ //
+ }
+//-------------------------------------------------------------------------------------------------//
+
+ public List<ManagedBeanType> getManagedBeans() {
+ final List<ManagedBeanType> allManagedBeans = new ArrayList<ManagedBeanType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList managedBeans = facesConfig.getManagedBean();
+ allManagedBeans.addAll(managedBeans);
+ }
+ return allManagedBeans;
+ }
+
+ public final List<String> getPropertyResolvers()
+ {
+ final List<String> allPropertyResolvers = new ArrayList<String>();
+ final List<ApplicationType> applications = getApplications();
+ for (final ApplicationType application : applications)
+ {
+ for (final Iterator it = application.getPropertyResolver().iterator(); it.hasNext();)
+ {
+ final PropertyResolverType propRes = (PropertyResolverType) it.next();
+ String propClass = propRes.getTextContent();
+ if (propClass != null)
+ {
+ propClass = propClass.trim();
+ if (!"".equals(propClass)) //$NON-NLS-1$
+ {
+ allPropertyResolvers.add(propClass);
+ }
+ }
+ }
+ }
+ return allPropertyResolvers;
+ }
+
+ public List<ValidatorType> getValidators() {
+ final List<ValidatorType> allValidators = new ArrayList<ValidatorType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList validators = facesConfig.getValidator();
+ allValidators.addAll(validators);
+ }
+ return allValidators;
+ }
+
+ public final List<String> getVariableResolvers()
+ {
+ final List<String> allVariableResolvers = new ArrayList<String>();
+ final List<ApplicationType> applications = getApplications();
+ for ( final ApplicationType application : applications)
+ {
+ for (final Iterator it = application.getVariableResolver().iterator(); it.hasNext();)
+ {
+ final VariableResolverType varRes = (VariableResolverType) it.next();
+ String varClass = varRes.getTextContent();
+ if (varClass != null)
+ {
+ varClass = varClass.trim();
+ if (!"".equals(varClass)) //$NON-NLS-1$
+ {
+ allVariableResolvers.add(varClass);
+ }
+ }
+ }
+ }
+ return allVariableResolvers;
+ }
+
+ public List<ConverterType> getConverters() {
+ final List<ConverterType> allConverters = new ArrayList<ConverterType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList converters = facesConfig.getConverter();
+ allConverters.addAll(converters);
+ }
+ return allConverters;
+ }
+
+ public List<NavigationRuleType> getNavigationRules() {
+ final List<NavigationRuleType> allNavigationRules = new ArrayList<NavigationRuleType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList navigationRules = facesConfig.getNavigationRule();
+ allNavigationRules.addAll(navigationRules);
+ }
+ return allNavigationRules;
+ }
+
+ public List<NavigationRuleType> getNavigationRulesForPage(final IFile pageFile) {
+ final List<NavigationRuleType> navigationRulesForPage = new ArrayList<NavigationRuleType>();
+ final IPath pageFilePath = JSFAppConfigUtils.getWebContentFolderRelativePath(pageFile);
+ if (pageFilePath != null) {
+ String pageFileString = pageFilePath.toString();
+ if (!pageFileString.startsWith("/")) { //$NON-NLS-1$
+ pageFileString = "/" + pageFileString; //$NON-NLS-1$
+ }
+ final List<NavigationRuleType> navigationRules = getNavigationRules();
+ for (final NavigationRuleType navigationRule : navigationRules) {
+ FromViewIdType fromViewIdType = navigationRule.getFromViewId();
+ if (fromViewIdType != null) {
+ final String fromViewId = fromViewIdType.getTextContent();
+ if (fromViewId != null && fromViewId.length() > 0) {
+ if (!fromViewId.equals("*")) { //$NON-NLS-1$
+ if (fromViewId.equals(pageFileString)) {
+ //exact match
+ navigationRulesForPage.add(navigationRule);
+ } else if (fromViewId.endsWith("*")) { //$NON-NLS-1$
+ final String prefixFromViewId = fromViewId.substring(0, fromViewId.length() - 1);
+ if (pageFileString.startsWith(prefixFromViewId)) {
+ //prefix match
+ navigationRulesForPage.add(navigationRule);
+ }
+ }
+ } else {
+ //from-view-id == "*" - matches all pages
+ navigationRulesForPage.add(navigationRule);
+ }
+ }
+ } else {
+ //no from-view-id element - matches all pages
+ navigationRulesForPage.add(navigationRule);
+ }
+ }
+ }
+ return navigationRulesForPage;
+ }
+
+ public List<ApplicationType> getApplications() {
+ final List<ApplicationType> allApplications = new ArrayList<ApplicationType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList applications = facesConfig.getApplication();
+ allApplications.addAll(applications);
+ }
+ return allApplications;
+ }
+
+ public List<FactoryType> getFactories() {
+ final List<FactoryType> allFactories = new ArrayList<FactoryType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList factories = facesConfig.getFactory();
+ allFactories.addAll(factories);
+ }
+ return allFactories;
+ }
+
+ public List<ComponentType> getComponents() {
+ final List<ComponentType> allComponents = new ArrayList<ComponentType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList components = facesConfig.getComponent();
+ allComponents.addAll(components);
+ }
+ return allComponents;
+ }
+
+ public List<ReferencedBeanType> getReferencedBeans() {
+ final List<ReferencedBeanType> allReferencedBeans = new ArrayList<ReferencedBeanType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList referencedBeans = facesConfig.getReferencedBean();
+ allReferencedBeans.addAll(referencedBeans);
+ }
+ return allReferencedBeans;
+ }
+
+ public List<RenderKitType> getRenderKits() {
+ final List<RenderKitType> allRenderKits = new ArrayList<RenderKitType> ();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList renderKits = facesConfig.getRenderKit();
+ allRenderKits.addAll(renderKits);
+ }
+ return allRenderKits;
+ }
+
+ public List<LifecycleType> getLifecycles() {
+ final List<LifecycleType> allLifecycles = new ArrayList<LifecycleType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList lifecycles = facesConfig.getLifecycle();
+ allLifecycles.addAll(lifecycles);
+ }
+ return allLifecycles;
+ }
+
+ public List<ResourceBundleType> getResourceBundles()
+ {
+ final List<ResourceBundleType> allResourceBundles = new ArrayList<ResourceBundleType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ for (final Iterator applicationIt = facesConfig.getApplication().iterator(); applicationIt.hasNext();)
+ {
+ final ApplicationType appType = (ApplicationType) applicationIt.next();
+ allResourceBundles.addAll(appType.getResourceBundle());
+ }
+ }
+ return allResourceBundles;
+ }
+
+ public List<BehaviorType> getBehaviors()
+ {
+ final List<BehaviorType> allBehaviors = new ArrayList<BehaviorType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList behaviors = facesConfig.getBehavior();
+ allBehaviors.addAll(behaviors);
+ }
+ return allBehaviors;
+ }
+
+ public List<FacesConfigExtensionType> getFacesConfigExtensions()
+ {
+ final List<FacesConfigExtensionType> allFCExts = new ArrayList<FacesConfigExtensionType>();
+ for (final FacesConfigType facesConfig : getFacesConfigModels()) {
+ final EList fcExts = facesConfig.getFacesConfigExtension();
+ allFCExts.addAll(fcExts);
+ }
+ return allFCExts;
+ }
+
+ public void addFacesConfigChangeAdapter(final FacesConfigType facesConfig) {
+ if (facesConfig != null) {
+ if (facesConfigChangeAdapter == null) {
+ facesConfigChangeAdapter = new FacesConfigChangeAdapter();
+ }
+ facesConfig.eAdapters().add(facesConfigChangeAdapter);
+ }
+ }
+
+ public void removeFacesConfigChangeAdapter(final FacesConfigType facesConfig) {
+ if (facesConfig != null && facesConfigChangeAdapter != null) {
+ facesConfig.eAdapters().remove(facesConfigChangeAdapter);
+ }
+ }
+
+ /**
+ * FacesConfigChangeAdapter is an EMF adapter which provides a mechanism
+ * for notification of changes to features in any application configuration
+ * model for which {@link IFacesConfigChangeListener} instances have
+ * registered an interest.
+ *
+ * @author Ian Trimble - Oracle
+ */
+ class FacesConfigChangeAdapter extends EContentAdapter {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecore.util.EContentAdapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+ public void notifyChanged(final Notification notification) {
+ super.notifyChanged(notification);
+ notifyFacesConfigChangeListeners(notification);
+ }
+ }
+
+
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManagerProviderStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManagerProviderStrategy.java
new file mode 100644
index 000000000..fb1162dda
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/AbstractJSFAppConfigManagerProviderStrategy.java
@@ -0,0 +1,16 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.common.internal.strategy.ISimpleStrategy;
+
+/**
+ * Abstract provider strategy for {@link IJSFAppConfigManager}s
+ *
+ */
+public abstract class AbstractJSFAppConfigManagerProviderStrategy
+ implements ISimpleStrategy<IProject, IJSFAppConfigManagerFactory> {
+
+ public IJSFAppConfigManagerFactory getNoResult() {
+ return null;
+ }
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/CompositeJSFAppConfigLocatorProviderStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/CompositeJSFAppConfigLocatorProviderStrategy.java
new file mode 100644
index 000000000..cab6c0cb8
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/CompositeJSFAppConfigLocatorProviderStrategy.java
@@ -0,0 +1,115 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jst.jsf.common.internal.pde.AbstractSimpleClassExtensionRegistryReader;
+import org.eclipse.jst.jsf.common.internal.strategy.AbstractTestableExtensibleDefaultProviderSelectionStrategy;
+import org.eclipse.jst.jsf.common.internal.strategy.TestableProjectFactoryStrategy;
+import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater;
+
+/**
+ * Composite strategy for providing {@link IJSFAppConfigLocatorProvider}s
+ *
+ */
+public class CompositeJSFAppConfigLocatorProviderStrategy
+ implements IJSFAppConfigLocatorProvider {
+
+ /**
+ * Project property session key for testing.
+ * Project value should hold the testable IJSFAppConfigLocatorProvider instance or null
+ * NOT API - for testing purposes
+ */
+ public static final QualifiedName TESTABLE_FACTORY_SESSION_KEY = new QualifiedName(JSFCorePlugin.PLUGIN_ID, "LocatorProviderStrategyFactory"); //$NON-NLS-1$
+
+ private IProject _project;
+
+ /**
+ * @param project - may be null
+ */
+ public CompositeJSFAppConfigLocatorProviderStrategy(final IProject project) {
+ _project = project;
+ }
+
+ public List<IJSFAppConfigLocater> getLocators() {
+ final LocatorProviderSelectionStrategy providerSelector = new LocatorProviderSelectionStrategy();
+ addLocatorProviderStrategies(providerSelector);
+
+ final IJSFAppConfigLocatorProvider provider = providerSelector.perform(_project);
+ if (provider != providerSelector.getNoResult())
+ {
+ return Collections.unmodifiableList(provider.getLocators());
+ }
+ return Collections.emptyList();
+ }
+
+ private void addLocatorProviderStrategies(final LocatorProviderSelectionStrategy providerSelector) {
+ providerSelector.addDefaultStrategy(new DefaultJSFAppConfigLocatorProviderStrategy());
+ providerSelector.addExtensionStrategy(new ExtensionPointLocatorProviderStrategy());
+ providerSelector.addTestableStrategy(new TestableLocatorProviderStrategy());
+ }
+
+ private static class TestableLocatorProviderStrategy extends
+ TestableProjectFactoryStrategy<IJSFAppConfigLocatorProvider> {
+
+ public TestableLocatorProviderStrategy() {
+ super(TESTABLE_FACTORY_SESSION_KEY);
+ }
+
+ };
+
+ private static class ExtensionPointLocatorProviderStrategy extends
+ JSFAppConfigLocatorProviderStrategy {
+
+ public IJSFAppConfigLocatorProvider perform(final IProject input) throws Exception {
+ final JSFAppConfigLocatorProviderExtensionPointReader reader = new JSFAppConfigLocatorProviderExtensionPointReader();
+ final List<IJSFAppConfigLocatorProvider> res = reader.getExtensions();
+ if (res != null && res.size() > 0) {
+ return res.get(0);
+ }
+ return getNoResult();
+ }
+
+ }
+
+ private static class LocatorProviderSelectionStrategy
+ extends
+ AbstractTestableExtensibleDefaultProviderSelectionStrategy<IProject, IJSFAppConfigLocatorProvider> {
+
+ private static final IJSFAppConfigLocatorProvider NO_RESULT = null;
+
+ @Override
+ public IJSFAppConfigLocatorProvider getNoResult() {
+ return NO_RESULT;
+ }
+
+ }
+
+ private static class JSFAppConfigLocatorProviderExtensionPointReader extends
+ AbstractSimpleClassExtensionRegistryReader<IJSFAppConfigLocatorProvider> {
+
+ private static final String EXT_PT_ID = "jsfAppConfigLocatorProviderFactory"; //$NON-NLS-1$
+ private static final String EXT_PT_ELEMENT = "locatorProvider"; //$NON-NLS-1$
+ private static final String EXT_PT_ATTR = "class"; //$NON-NLS-1$
+
+ protected JSFAppConfigLocatorProviderExtensionPointReader() {
+ super(
+ org.eclipse.jst.jsf.core.internal.JSFCorePlugin.PLUGIN_ID,
+ EXT_PT_ID, EXT_PT_ELEMENT, EXT_PT_ATTR,
+ new CompareOrgEclipseJstContributorsLastComparator<IJSFAppConfigLocatorProvider>()
+ );
+ }
+
+ @Override
+ protected void handleLoadFailure(final CoreException ce) {
+ org.eclipse.jst.jsf.core.internal.JSFCorePlugin.log(ce,
+ "Error loading JSFAppConfigLocatorProvider from extension"); //$NON-NLS-1$
+
+ }
+
+ }
+} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigLocatorProviderStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigLocatorProviderStrategy.java
new file mode 100644
index 000000000..b4a16dd77
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigLocatorProviderStrategy.java
@@ -0,0 +1,56 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.core.jsfappconfig.ContextParamSpecifiedJSFAppConfigLocater;
+import org.eclipse.jst.jsf.core.jsfappconfig.DefaultJSFAppConfigLocater;
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater;
+import org.eclipse.jst.jsf.core.jsfappconfig.ImplicitRuntimeJSFAppConfigLocater;
+import org.eclipse.jst.jsf.core.jsfappconfig.RuntimeClasspathJSFAppConfigLocater;
+
+/**
+ * The platforms default LocatorProviderStrategy.
+ * <p>
+ * Will return:
+ * <ol>
+ * <li>ImplicitRuntimeJSFAppConfigLocater</li>
+ * <li>DefaultJSFAppConfigLocater</li>
+ * <li>ContextParamSpecifiedJSFAppConfigLocater</li>
+ * <li>RuntimeClasspathJSFAppConfigLocater</li>
+ * <ol>
+ *
+ */
+public class DefaultJSFAppConfigLocatorProviderStrategy
+ extends JSFAppConfigLocatorProviderStrategy
+ implements IJSFAppConfigLocatorProvider {
+
+ public IJSFAppConfigLocatorProvider perform(IProject project) {
+ return this;
+ }
+
+ public List<IJSFAppConfigLocater> getLocators() {
+ List<IJSFAppConfigLocater> ret = new ArrayList<IJSFAppConfigLocater>();
+
+ // implicit runtime-provided configuration
+ IJSFAppConfigLocater implicitRuntimeConfigLocater = new ImplicitRuntimeJSFAppConfigLocater();
+ ret.add(implicitRuntimeConfigLocater);
+
+ // default ("/WEB-INF/faces-config.xml") locater
+ IJSFAppConfigLocater defaultConfigLocater = new DefaultJSFAppConfigLocater();
+ ret.add(defaultConfigLocater);
+
+ // web.xml context-parameter specified locater
+ IJSFAppConfigLocater contextParamConfigLocater = new ContextParamSpecifiedJSFAppConfigLocater();
+ ret.add(contextParamConfigLocater);
+
+ // runtime classpath locater
+ IJSFAppConfigLocater classpathConfigLocater = new RuntimeClasspathJSFAppConfigLocater();
+ ret.add(classpathConfigLocater);
+
+ return Collections.unmodifiableList(ret);
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigManagerProviderStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigManagerProviderStrategy.java
new file mode 100644
index 000000000..445ee998c
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/DefaultJSFAppConfigManagerProviderStrategy.java
@@ -0,0 +1,28 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+
+/**
+ * Default strategy for returning {@link IJSFAppConfigManager}s
+ *
+ */
+@SuppressWarnings("deprecation")
+public class DefaultJSFAppConfigManagerProviderStrategy extends
+ AbstractJSFAppConfigManagerProviderStrategy {
+
+ public IJSFAppConfigManagerFactory perform(final IProject input) throws Exception {
+ return new DefaultProvider();
+ }
+
+ private static class DefaultProvider
+ implements IJSFAppConfigManagerFactory {
+
+ public IJSFAppConfigManager getInstance(final IProject project) {
+ //deprecated warning is to be expected here
+ return JSFAppConfigManager.getInstance(project);
+ }
+
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/ExtensionBasedJSFAppConfigManagerProviderStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/ExtensionBasedJSFAppConfigManagerProviderStrategy.java
new file mode 100644
index 000000000..c68aabf42
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/ExtensionBasedJSFAppConfigManagerProviderStrategy.java
@@ -0,0 +1,53 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.jsf.common.internal.pde.AbstractSimpleClassExtensionRegistryReader;
+
+/**
+ * Extension-based strategy for returning {@link IJSFAppConfigManager}s
+ *
+ */
+public class ExtensionBasedJSFAppConfigManagerProviderStrategy extends
+ AbstractJSFAppConfigManagerProviderStrategy {
+
+ private static IJSFAppConfigManagerFactory EXT_PT_BASED_FACTORY;
+ static {
+ final JSFAppConfigManagerFactoryExtensionPointReader reader = new JSFAppConfigManagerFactoryExtensionPointReader();
+ final List<IJSFAppConfigManagerFactory> res = reader.getExtensions();
+ if (res != null && res.size() > 0) {//return first
+ EXT_PT_BASED_FACTORY = res.get(0);
+ }
+ }
+
+ public IJSFAppConfigManagerFactory perform(final IProject input) throws Exception {
+ return EXT_PT_BASED_FACTORY != null ? EXT_PT_BASED_FACTORY : getNoResult();
+ }
+
+ private static class JSFAppConfigManagerFactoryExtensionPointReader extends
+ AbstractSimpleClassExtensionRegistryReader<IJSFAppConfigManagerFactory> {
+
+ private static final String EXT_PT_ID = "jsfAppConfigManagerFactory"; //$NON-NLS-1$
+ private static final String EXT_PT_ELEMENT = "factory"; //$NON-NLS-1$
+ private static final String EXT_PT_ATTR = "class"; //$NON-NLS-1$
+
+ protected JSFAppConfigManagerFactoryExtensionPointReader() {
+ super(
+ org.eclipse.jst.jsf.core.internal.JSFCorePlugin.PLUGIN_ID,
+ EXT_PT_ID, EXT_PT_ELEMENT, EXT_PT_ATTR,
+ new CompareOrgEclipseJstContributorsLastComparator<IJSFAppConfigManagerFactory>()
+ );
+ }
+
+ @Override
+ protected void handleLoadFailure(final CoreException ce) {
+ org.eclipse.jst.jsf.core.internal.JSFCorePlugin.log(ce,
+ "Error loading JSFAppConfigLocatorProvider from extension"); //$NON-NLS-1$
+
+ }
+
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigLocatorProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigLocatorProvider.java
new file mode 100644
index 000000000..1f20003d3
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigLocatorProvider.java
@@ -0,0 +1,16 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import java.util.List;
+
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigLocater;
+
+/**
+ * Provides list of {@link IJSFAppConfigLocater}s
+ *
+ */
+public interface IJSFAppConfigLocatorProvider {
+ /**
+ * @return list of ILocators
+ */
+ List<IJSFAppConfigLocater> getLocators();
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManager.java
new file mode 100644
index 000000000..94200806b
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManager.java
@@ -0,0 +1,279 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject;
+import org.eclipse.jst.jsf.core.jsfappconfig.IFacesConfigChangeListener;
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvider;
+import org.eclipse.jst.jsf.core.jsfappconfig.IJSFAppConfigProvidersChangeListener;
+import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
+import org.eclipse.jst.jsf.facesconfig.emf.BehaviorType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigExtensionType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.LifecycleType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
+import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
+import org.eclipse.jst.jsf.facesconfig.emf.ResourceBundleType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
+
+/**
+ * Mostly represents a web applications JSF configuration.
+ * <p>
+ * This is a merged view of all the faces-config elements.
+ *
+ * @noimplement - must extend {@link AbstractJSFAppConfigManager}
+ */
+public interface IJSFAppConfigManager extends IManagedObject{
+
+ /**
+ * Gets this instance's IProject instance.
+ *
+ * @return This instance's IProject instance.
+ */
+ public IProject getProject();
+
+ /**
+ * Adds an instance of {@link IJSFAppConfigProvidersChangeListener}.
+ *
+ * @param listener An instance of {@link IJSFAppConfigProvidersChangeListener}.
+ * @return true if added, else false.
+ */
+ public boolean addJSFAppConfigProvidersChangeListener(
+ IJSFAppConfigProvidersChangeListener listener);
+
+ /**
+ * Removes an instance of {@link IJSFAppConfigProvidersChangeListener}.
+ *
+ * @param listener an instance of {@link IJSFAppConfigProvidersChangeListener}.
+ * @return true if removed, else false.
+ */
+ public boolean removeJSFAppConfigProvidersChangeListener(
+ IJSFAppConfigProvidersChangeListener listener);
+
+ /**
+ * Notifies all {@link IJSFAppConfigProvidersChangeListener} instances of
+ * a change in the Set of {@link IJSFAppConfigProvider} instances.
+ *
+ * @param configProvider {@link IJSFAppConfigProvider} instance that has
+ * changed.
+ * @param eventType Event type.
+ */
+ public void notifyJSFAppConfigProvidersChangeListeners(
+ IJSFAppConfigProvider configProvider, int eventType);
+
+ /**
+ * Adds an instance of {@link IFacesConfigChangeListener}. <br>
+ * <br>
+ * <b>NOTE:</b> Calling this method should cause all application
+ * configuration models to be loaded, to ensure that a
+ * FacesConfigChangeAdapter has been added to each model
+ * if the model is updateable.
+ *
+ * @param emfClass EMF class in which the listener is interested.
+ * @param listener {@link IFacesConfigChangeListener} instance.
+ * @return Previous {@link IFacesConfigChangeListener}, or null.
+ */
+ public Object addFacesConfigChangeListener(Class emfClass,
+ IFacesConfigChangeListener listener);
+
+ /**
+ * Removes an instance of {@link IFacesConfigChangeListener}.
+ *
+ * @param emfClass EMF class in which the listener was interested.
+ * @return Removed {@link IFacesConfigChangeListener}, or null.
+ */
+ public Object removeFacesConfigChangeListener(Class emfClass);
+
+ /**
+ * Notifies {@link IFacesConfigChangeListener} instances of model changes
+ * in which they registered interest.
+ *
+ * @param notification EMF {@link Notification} instance that describes the
+ * model change.
+ */
+ public void notifyFacesConfigChangeListeners(
+ Notification notification);
+
+// /**
+// * Gets all {@link IJSFAppConfigProvider} instances from all
+// * {@link IJSFAppConfigLocater} instances.
+// *
+// * @return Set of all {@link IJSFAppConfigProvider} instances.
+// */
+// public Set<IJSFAppConfigProvider> getJSFAppConfigProviders();
+
+// /**
+// * Gets all {@link FacesConfigType} instances from all
+// * {@link IJSFAppConfigProvider} instances.
+// *
+// * @return List of all {@link FacesConfigType} instances.
+// */
+// public List<FacesConfigType> getFacesConfigModels();
+
+ /**
+ * Gets list of all ManagedBeanType instances from all known faces-config
+ * models; list may be empty.
+ *
+ * @return List of all ManagedBeanType instances from all known
+ * faces-config models (list may be empty).
+ */
+ public List<ManagedBeanType> getManagedBeans();
+
+ /**
+ * @return List of all variable resolver class names registered.
+ */
+ public List<String> getPropertyResolvers();
+
+ /**
+ * Gets list of all ValidatorType instances from all known faces-config
+ * models; list may be empty.
+ *
+ * @return List of all ValidatorType instances from all known faces-config
+ * models (list may be empty).
+ */
+ public List<ValidatorType> getValidators();
+
+ /**
+ * @return List of all variable resolver class names registered.
+ */
+ public List<String> getVariableResolvers();
+
+ /**
+ * Gets list of all ConverterType instances from all known faces-config
+ * models; list may be empty.
+ *
+ * @return List of all ConverterType instances from all known faces-config
+ * models (list may be empty).
+ */
+ public List<ConverterType> getConverters();
+
+ /**
+ * Gets list of all NavigationRuleType instances from all known
+ * faces-config models; list may be empty.
+ *
+ * @return List of all NavigationRuleType instances from all known
+ * faces-config models (list may be empty).
+ */
+ public List<NavigationRuleType> getNavigationRules();
+
+ /**
+ * Gets list of all NavigationRuleType instances from all known
+ * faces-config models where the navigation-rule's from-view-id value
+ * matches the web content folder-relative value of the passed IFile
+ * instance; list may be empty. Matching is performed in the same manner
+ * as for a JSF implementation's default NavigationHandler.
+ *
+ * @param pageFile IFile instance to match against the from-view-id value
+ * of all NavigationRuleType instances. File is assumed to be relative to
+ * the web content folder, but may be expressed in a more complete form;
+ * its path will be calculated relative to the web content folder.
+ * @return List of all NavigationRuleType instances from all known
+ * faces-config models where the navigation-rule's from-view-id value
+ * matches the web content folder-relative value of the passed IFile
+ * instance (list may be empty).
+ */
+ public List<NavigationRuleType> getNavigationRulesForPage(IFile pageFile);
+
+ /**
+ * Gets list of all ApplicationType instances from all known
+ * faces-config models; list may be empty.
+ *
+ * @return List of all ApplicationType instances from all known
+ * faces-config models (list may be empty).
+ */
+ public List<ApplicationType> getApplications();
+
+ /**
+ * Gets list of all FactoryType instances from all known faces-config
+ * models; list may be empty.
+ *
+ * @return List of all FactoryType instances from all known faces-config
+ * models (list may be empty).
+ */
+ public List<FactoryType> getFactories();
+
+ /**
+ * Gets list of all ComponentType instances from all known faces-config
+ * models; list may be empty.
+ *
+ * @return List of all ComponentType instances from all known faces-config
+ * models (list may be empty).
+ */
+ public List<ComponentType> getComponents();
+
+ /**
+ * Gets list of all ReferencedBeanType instances from all known
+ * faces-config models; list may be empty.
+ *
+ * @return List of all ReferencedBeanType instances from all known
+ * faces-config models (list may be empty).
+ */
+ public List<ReferencedBeanType> getReferencedBeans();
+
+ /**
+ * Gets list of all RenderKitType instances from all known faces-config
+ * models; list may be empty.
+ *
+ * @return List of all RenderKitType instances from all known faces-config
+ * models (list may be empty).
+ */
+ public List<RenderKitType> getRenderKits();
+
+ /**
+ * Gets list of all LifecycleType instances from all known faces-config
+ * models; list may be empty.
+ *
+ * @return List of all LifecycleType instances from all known faces-config
+ * models (list may be empty).
+ */
+ public List<LifecycleType> getLifecycles();
+
+ /**
+ * @return the list of all resource bundles declared in all the FacesConfig
+ * configurations found.
+ */
+ public List<ResourceBundleType> getResourceBundles();
+
+ /**
+ * @return the list of faces config extensions declared in all FacesConfig
+ * configurations found
+ */
+ public List<FacesConfigExtensionType> getFacesConfigExtensions();
+
+/* -------------------------- JSF 2.0 ---------------------------------------- */
+
+ /**
+ * @return the list of behaviors declared in all FacesConfig configurations found
+ */
+ public List<BehaviorType> getBehaviors();
+
+ //do we want ordering?
+
+
+/* ---------------------------------------------------------------------------- */
+ /**
+ * Adds this instance's FacesConfigChangeAdapter instance to the
+ * passed application configuration model's adapters collection.
+ *
+ * @param facesConfig Application configuration model's root object.
+ */
+ public void addFacesConfigChangeAdapter(FacesConfigType facesConfig);
+
+ /**
+ * Removes this instance's FacesConfigChangeAdapter instance from
+ * the passed application configuration model's adapters collection.
+ *
+ * @param facesConfig Application configuration model's root object.
+ */
+ public void removeFacesConfigChangeAdapter(
+ FacesConfigType facesConfig);
+
+} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManagerFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManagerFactory.java
new file mode 100644
index 000000000..533638828
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/IJSFAppConfigManagerFactory.java
@@ -0,0 +1,18 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.common.internal.managedobject.ObjectManager.ManagedObjectException;
+
+/**
+ * Factory for creating {@link IJSFAppConfigManager} instances.
+ * <p>
+ * NOT API
+ */
+public interface IJSFAppConfigManagerFactory {
+ /**
+ * @param project - may be null
+ * @return instance of an {@link IJSFAppConfigManager} for the project.
+ * @throws ManagedObjectException
+ */
+ IJSFAppConfigManager getInstance(IProject project) throws ManagedObjectException;
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigLocatorProviderStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigLocatorProviderStrategy.java
new file mode 100644
index 000000000..e62593522
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigLocatorProviderStrategy.java
@@ -0,0 +1,16 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.common.internal.strategy.ISimpleStrategy;
+
+/**
+ * Abstract implementation of a JSFAppConfigLocatorProviderStrategy
+ * implementing {@link ISimpleStrategy}
+ */
+public abstract class JSFAppConfigLocatorProviderStrategy
+ implements ISimpleStrategy<IProject, IJSFAppConfigLocatorProvider> {
+
+ public IJSFAppConfigLocatorProvider getNoResult() {
+ return null;
+ }
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigManagerFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigManagerFactory.java
new file mode 100644
index 000000000..631bfa209
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/JSFAppConfigManagerFactory.java
@@ -0,0 +1,104 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager;
+import org.eclipse.jst.jsf.common.internal.strategy.AbstractTestableExtensibleDefaultProviderSelectionStrategy;
+import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
+
+/**
+ * Responsible for producing and caching {@link IJSFAppConfigManager} instances by project.
+ * <p>
+ * This class will guarantee that he same instance of the {@link IJSFAppConfigManager} is returned for a given project
+ *
+ */
+public class JSFAppConfigManagerFactory
+ extends
+ ResourceSingletonObjectManager<IJSFAppConfigManager, IProject>{
+
+ private static JSFAppConfigManagerFactory INSTANCE;
+
+ //private constructor
+ private JSFAppConfigManagerFactory(final IProject project) {
+ super(project.getWorkspace());
+ }
+
+ /**
+ * Project property session key for testing.
+ * Project value should hold the testable IJSFAppConfigManagerFactory instance or null
+ * NOT API - for testing purposes
+ */
+ public static final QualifiedName TESTABLE_FACTORY_SESSION_KEY = new QualifiedName(JSFCorePlugin.PLUGIN_ID, "JSFAppConfigManagerFactoryInstance"); //$NON-NLS-1$
+
+ /**
+ * @param project
+ * @return IJSFAppConfigManager
+ */
+ public synchronized static IJSFAppConfigManager getJSFAppConfigManagerInstance(final IProject project) {
+ try {
+ return getJSFAppConfigManagerFactoryInstance(project).getInstance(project);
+ } catch (ManagedObjectException e) {
+ JSFCorePlugin.log(e, "Cannot create IJSFAppConfigManager for "+project.getName()+ " (1)"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return null;
+ }
+
+ private static JSFAppConfigManagerFactory getJSFAppConfigManagerFactoryInstance(final IProject project) {
+ if (INSTANCE == null) {
+ INSTANCE = new JSFAppConfigManagerFactory(project);
+ }
+ return INSTANCE;
+ }
+
+ @Override
+ protected IJSFAppConfigManager createNewInstance(final IProject project) {
+ try {
+ final IJSFAppConfigManagerFactory factory = getJSFAppConfigManagerFactoryProviderInstance(project);
+ if (factory != null)
+ return factory.getInstance(project);
+ } catch (ManagedObjectException e) {
+ JSFCorePlugin.log(e, "Cannot create IJSFAppConfigManager for "+project.getName()+ " (2)"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return null;
+ }
+
+ private IJSFAppConfigManagerFactory getJSFAppConfigManagerFactoryProviderInstance(final IProject project) {
+ final CompositeFactorySelectionStrategyProvider factoryProvider = new CompositeFactorySelectionStrategyProvider();
+ return factoryProvider != null ? factoryProvider.getFactoryToUse(project) : null;
+ }
+
+ private static class CompositeFactorySelectionStrategyProvider
+ {
+ public IJSFAppConfigManagerFactory getFactoryToUse(final IProject project) {
+ final JSFAppConfigManagerProviderSelectionStrategy providerSelector = new JSFAppConfigManagerProviderSelectionStrategy();
+ addStrategies(providerSelector);
+
+ final IJSFAppConfigManagerFactory provider = providerSelector.perform(project);
+ if (provider != providerSelector.getNoResult())
+ {
+ return provider;
+ }
+ return null;
+ }
+
+ private void addStrategies(final JSFAppConfigManagerProviderSelectionStrategy providerSelector) {
+ providerSelector.addDefaultStrategy(new DefaultJSFAppConfigManagerProviderStrategy());
+ providerSelector.addExtensionStrategy(new ExtensionBasedJSFAppConfigManagerProviderStrategy());
+ providerSelector.addTestableStrategy(new TestableJSFAppConfigManagerProviderStrategy(TESTABLE_FACTORY_SESSION_KEY));
+ }
+
+ }
+
+ private static class JSFAppConfigManagerProviderSelectionStrategy
+ extends
+ AbstractTestableExtensibleDefaultProviderSelectionStrategy<IProject, IJSFAppConfigManagerFactory> {
+
+ private static final IJSFAppConfigManagerFactory NO_RESULT = null;
+
+ @Override
+ public IJSFAppConfigManagerFactory getNoResult() {
+ return NO_RESULT;
+ }
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/TestableJSFAppConfigManagerProviderStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/TestableJSFAppConfigManagerProviderStrategy.java
new file mode 100644
index 000000000..78ab773ba
--- /dev/null
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/jsfappconfig/internal/TestableJSFAppConfigManagerProviderStrategy.java
@@ -0,0 +1,21 @@
+package org.eclipse.jst.jsf.core.jsfappconfig.internal;
+
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jst.jsf.common.internal.strategy.TestableProjectFactoryStrategy;
+
+/**
+ * Injectable test factory provider strategy
+ * @param <IJSFAppConfigManagerFactory>
+ *
+ */
+public class TestableJSFAppConfigManagerProviderStrategy<IJSFAppConfigManagerFactory>
+ extends TestableProjectFactoryStrategy<IJSFAppConfigManagerFactory> {
+
+ /**
+ * @param testableFactorySessionKey - project property session key for property value holding testable instance
+ */
+ public TestableJSFAppConfigManagerProviderStrategy(final QualifiedName testableFactorySessionKey) {
+ super(testableFactorySessionKey);
+ }
+
+}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java
index a48afd3f3..557706bef 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTPropertyResolver.java
@@ -20,7 +20,8 @@ import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.jst.jsf.context.symbol.ISymbol;
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.designtime.el.AbstractDTPropertyResolver;
import org.eclipse.jst.jsf.designtime.el.DefaultDTPropertyResolver;
import org.eclipse.jst.jsf.designtime.el.IDecorativeResolver;
@@ -121,8 +122,8 @@ public class ConfigBasedDTPropertyResolver extends DefaultDTPropertyResolver
private List<AbstractDTPropertyResolver> retrieveDecorativePropertyResolvers(
final IProject project)
{
- final JSFAppConfigManager manager = JSFAppConfigManager
- .getInstance(project);
+ final IJSFAppConfigManager manager = JSFAppConfigManagerFactory
+ .getJSFAppConfigManagerInstance(project);
final List<String> propertyResolvers = manager.getPropertyResolvers();
final List<AbstractDTPropertyResolver> resolvers = new ArrayList<AbstractDTPropertyResolver>();
for (final String propertyResolver : propertyResolvers)
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java
index 187d8a643..5acd1684f 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ConfigBasedDTVariableResolver.java
@@ -23,7 +23,8 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jst.jsf.context.symbol.ISymbol;
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.designtime.context.DTFacesContext;
import org.eclipse.jst.jsf.designtime.el.AbstractDTVariableResolver;
import org.eclipse.jst.jsf.designtime.el.DefaultDTVariableResolver;
@@ -113,8 +114,8 @@ public class ConfigBasedDTVariableResolver extends DefaultDTVariableResolver
final IProject project)
{
//final long curTime = System.nanoTime();
- final JSFAppConfigManager manager = JSFAppConfigManager
- .getInstance(project);
+ final IJSFAppConfigManager manager = JSFAppConfigManagerFactory
+ .getJSFAppConfigManagerInstance(project);
final List<String> variableResolvers = manager.getVariableResolvers();
final List<AbstractDTVariableResolver> resolvers = new ArrayList<AbstractDTVariableResolver>();
for (final String variableResolver : variableResolvers)
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java
index b96b8a89a..1b39e94dd 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/symbols/ResourceBundleSymbolSourceProvider.java
@@ -12,7 +12,6 @@ package org.eclipse.jst.jsf.designtime.internal.symbols;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -29,8 +28,9 @@ import org.eclipse.jst.jsf.context.symbol.source.AbstractSymbolSourceProviderFac
import org.eclipse.jst.jsf.context.symbol.source.ISymbolSourceProvider;
import org.eclipse.jst.jsf.core.IJSFCoreConstants;
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.designtime.symbols.FileContextUtil;
import org.eclipse.jst.jsf.designtime.symbols.SymbolUtil;
import org.eclipse.jst.jsf.facesconfig.emf.BaseNameType;
@@ -67,12 +67,11 @@ public final class ResourceBundleSymbolSourceProvider extends
final IFile fileContext = FileContextUtil.deriveIFileFromContext(context);
final IProject project = fileContext.getProject();
- final JSFAppConfigManager appconfigMgr = JSFAppConfigManager.getInstance(project);
- final List resourceBundles = appconfigMgr.getResourceBundles();
+ final IJSFAppConfigManager appconfigMgr = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(project);
+ final List<ResourceBundleType> resourceBundles = appconfigMgr.getResourceBundles();
- for (final Iterator it = resourceBundles.iterator(); it.hasNext();)
- {
- ResourceBundleType resBundle = (ResourceBundleType) it.next();
+ for (final ResourceBundleType resBundle : resourceBundles)
+ {
final String basename = getBaseName(resBundle);
final String name = getVarName(resBundle);
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java
index 04c71e3a4..66763f4e8 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/DTComponentIntrospector.java
@@ -12,7 +12,6 @@ package org.eclipse.jst.jsf.designtime.internal.view;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -39,7 +38,8 @@ import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions;
import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.BeanProxyWrapper;
import org.eclipse.jst.jsf.core.internal.jem.BeanProxyUtil.ProxyException;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
@@ -209,13 +209,12 @@ public final class DTComponentIntrospector
public static String findComponentClass(final String componentType,
final IProject project)
{
- final JSFAppConfigManager manager = JSFAppConfigManager
- .getInstance(project);
- final List components = manager.getComponents();
+ final IJSFAppConfigManager manager = JSFAppConfigManagerFactory
+ .getJSFAppConfigManagerInstance(project);
+ final List<ComponentType> components = manager.getComponents();
- for (final Iterator it = components.iterator(); it.hasNext();)
+ for (final ComponentType component : components)
{
- final ComponentType component = (ComponentType) it.next();
final String type = component.getComponentType().getTextContent()
.trim();
@@ -236,14 +235,12 @@ public final class DTComponentIntrospector
public static String findConverterClass(final String converterId,
final IProject project)
{
- final JSFAppConfigManager manager = JSFAppConfigManager
- .getInstance(project);
- final List converters = manager.getConverters();
+ final IJSFAppConfigManager manager = JSFAppConfigManagerFactory
+ .getJSFAppConfigManagerInstance(project);
+ final List<ConverterType> converters = manager.getConverters();
- for (final Iterator it = converters.iterator(); it.hasNext();)
+ for (final ConverterType converter : converters)
{
- final ConverterType converter = (ConverterType) it.next();
-
if (converter != null && converter.getConverterId() != null
&& converter.getConverterId().getTextContent() != null)
{
@@ -273,14 +270,12 @@ public final class DTComponentIntrospector
public static String findValidatorClass(final String validatorId,
final IProject project)
{
- final JSFAppConfigManager manager = JSFAppConfigManager
- .getInstance(project);
- final List converters = manager.getValidators();
+ final IJSFAppConfigManager manager = JSFAppConfigManagerFactory
+ .getJSFAppConfigManagerInstance(project);
+ final List<ValidatorType> validators = manager.getValidators();
- for (final Iterator it = converters.iterator(); it.hasNext();)
+ for (final ValidatorType validatorType : validators)
{
- final ValidatorType validatorType = (ValidatorType) it.next();
-
if (validatorType != null && validatorType.getValidatorId() != null &&
validatorType.getValidatorId().getTextContent() != null)
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java
index 540d47257..f5f1ee85f 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java
@@ -29,7 +29,8 @@ import org.eclipse.jst.jsf.context.symbol.IJavaTypeDescriptor2;
import org.eclipse.jst.jsf.context.symbol.ISymbol;
import org.eclipse.jst.jsf.context.symbol.SymbolFactory;
import org.eclipse.jst.jsf.context.symbol.source.ISymbolConstants;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
@@ -117,7 +118,7 @@ public class DefaultBeanSymbolSourceProvider
{
List symbols = new ArrayList();
- final JSFAppConfigManager configManager = JSFAppConfigManager.getInstance(iProject);
+ final IJSFAppConfigManager configManager = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(iProject);
if (configManager != null)
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java
index d072810c2..4e87c5515 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/taglibprocessing/attributevalues/ActionType.java
@@ -23,7 +23,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory;
import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.facesconfig.FacesConfigPlugin;
import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
@@ -66,13 +66,12 @@ public class ActionType extends MethodBindingType implements IPossibleValues{
return true;//shouldn't get here
//in case that this is not JSF faceted or missing configs, need to pass
- if (JSFAppConfigManager.getInstance(wr.getProject()) == null)
+ if (JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()) == null)
return true;
IFile jsp = (IFile)wr.getResource();
- List rules = JSFAppConfigManager.getInstance(wr.getProject()).getNavigationRulesForPage(jsp);
- for(Iterator it=rules.iterator();it.hasNext();){
- NavigationRuleType rule = (NavigationRuleType)it.next();
+ List<NavigationRuleType> rules = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()).getNavigationRulesForPage(jsp);
+ for(final NavigationRuleType rule : rules){
for (Iterator cases=rule.getNavigationCase().iterator();cases.hasNext();){
NavigationCaseType navCase = (NavigationCaseType)cases.next();
if (navCase.getFromOutcome() != null &&
@@ -90,16 +89,15 @@ public class ActionType extends MethodBindingType implements IPossibleValues{
* @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues#getPossibleValues()
*/
public List getPossibleValues() {
- List ret = new ArrayList();
+ final List<NavigationRuleType> ret = new ArrayList<NavigationRuleType>();
if (getStructuredDocumentContext() == null)
return ret;
- IWorkspaceContextResolver wr = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext());
- if (wr != null && JSFAppConfigManager.getInstance(wr.getProject()) != null) {//may not be JSF faceted project or know faces-config){
+ final IWorkspaceContextResolver wr = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(getStructuredDocumentContext());
+ if (wr != null && JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()) != null) {//may not be JSF faceted project or know faces-config){
IFile jsp = (IFile)wr.getResource();
- List rules = JSFAppConfigManager.getInstance(wr.getProject()).getNavigationRulesForPage(jsp);
- for(Iterator it=rules.iterator();it.hasNext();){
- NavigationRuleType rule = (NavigationRuleType)it.next();
+ List<NavigationRuleType> rules = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(wr.getProject()).getNavigationRulesForPage(jsp);
+ for(final NavigationRuleType rule : rules){
if (rule != null)
ret.addAll(createProposals(rule));
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java
index 7be62a0a6..7f887a21e 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/strategy/AttributeValidatingStrategy.java
@@ -47,13 +47,14 @@ import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
import org.eclipse.jst.jsf.core.internal.region.Region2AttrAdapter;
import org.eclipse.jst.jsf.core.internal.region.Region2ElementAdapter;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.designtime.DTAppManagerUtil;
import org.eclipse.jst.jsf.designtime.internal.view.DTUIViewRoot;
-import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter;
-import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService;
import org.eclipse.jst.jsf.designtime.internal.view.IDTViewHandler.ViewHandlerException;
+import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter;
import org.eclipse.jst.jsf.designtime.internal.view.XMLViewDefnAdapter.DTELExpression;
+import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService;
import org.eclipse.jst.jsf.designtime.internal.view.XMLViewObjectMappingService.ElementData;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
@@ -543,11 +544,10 @@ AbstractXMLViewValidationStrategy
{
_conversionTypes = new HashSet<String>();
final IProject project = _validationContext.getFile().getProject();
- final JSFAppConfigManager appConfig = JSFAppConfigManager.getInstance(project);
- final List converters = appConfig.getConverters();
- for (final Iterator it = converters.iterator(); it.hasNext();)
+ final IJSFAppConfigManager appConfig = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(project);
+ final List<ConverterType> converters = appConfig.getConverters();
+ for (final ConverterType converterType : converters)
{
- final ConverterType converterType = (ConverterType) it.next();
final ConverterForClassType forClassType = converterType.getConverterForClass();
if (forClassType != null)
{
diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java
index c17cb9faf..337fe22d7 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/util/ManagedBeanUtil.java
@@ -12,11 +12,11 @@
package org.eclipse.jst.jsf.facesconfig.ui.util;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
/**
@@ -36,25 +36,21 @@ public class ManagedBeanUtil {
* @return int - 0 if bean doesn't exist, otherwise the choice from the
* Duplicate Bean dialog
*/
- public static boolean isBeanDuplicate(IProject project, String beanName)
+ public static boolean isBeanDuplicate(final IProject project, final String beanName)
{
- JSFAppConfigManager appCfgMgr = JSFAppConfigManager.getInstance(project);
+ final IJSFAppConfigManager appCfgMgr = JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(project);
if (appCfgMgr != null)
{
- List beans = appCfgMgr.getManagedBeans();
+ final List<ManagedBeanType> beans = appCfgMgr.getManagedBeans();
// Iterate through the bean list
- for (Iterator i = beans.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o instanceof ManagedBeanType) {
- ManagedBeanType mbti = (ManagedBeanType) o;
- if (mbti.getManagedBeanName() != null) {
- String name = mbti.getManagedBeanName()
- .getTextContent();
- if (name != null && name.equals(beanName)) {
- return true;
- }
+ for (final ManagedBeanType mbti : beans) {
+ if (mbti.getManagedBeanName() != null) {
+ final String name = mbti.getManagedBeanName()
+ .getTextContent();
+ if (name != null && name.equals(beanName)) {
+ return true;
}
}
}
@@ -73,8 +69,8 @@ public class ManagedBeanUtil {
* seed reference name
* @return String - default managed bean name
*/
- public static String getDefaultManagedBeanName(IProject project,
- String refName) {
+ public static String getDefaultManagedBeanName(final IProject project,
+ final String refName) {
String defaultName = refName;
int newRefNameIndex = 1;
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java
index 98127d792..8deaeafd3 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java
@@ -12,7 +12,6 @@
package org.eclipse.jst.pagedesigner.jsf.ui.actions;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -23,7 +22,8 @@ import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.IJSFAppConfigManager;
+import org.eclipse.jst.jsf.core.jsfappconfig.internal.JSFAppConfigManagerFactory;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterIdType;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
import org.eclipse.jst.jsf.facesconfig.emf.ValidatorIdType;
@@ -163,19 +163,18 @@ public class JSFAddActionGroup {
{
String[] result = null;
- JSFAppConfigManager appConfigMgr =
- JSFAppConfigManager.getInstance(project);
+ IJSFAppConfigManager appConfigMgr =
+ JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(project);
// getInstance may return null if there is a problem
if (appConfigMgr != null)
{
- final List list = appConfigMgr.getValidators();
+ final List<ValidatorType> list = appConfigMgr.getValidators();
result = new String[list.size()];
int i = 0;
- for (final Iterator it = list.iterator(); it.hasNext();)
+ for (final ValidatorType validator : list)
{
- ValidatorType validator = (ValidatorType) it.next();
- ValidatorIdType validatorId = validator.getValidatorId();
+ ValidatorIdType validatorId = validator.getValidatorId();
if (validatorId != null)
{
result[i++] = validatorId.getTextContent() != null ?
@@ -193,18 +192,17 @@ public class JSFAddActionGroup {
{
String[] result = null;
- JSFAppConfigManager appConfigMgr =
- JSFAppConfigManager.getInstance(project);
+ IJSFAppConfigManager appConfigMgr =
+ JSFAppConfigManagerFactory.getJSFAppConfigManagerInstance(project);
// getInstance may return null if there is a problem
if (appConfigMgr != null)
{
- final List list = appConfigMgr.getConverters();
+ final List<ConverterType> list = appConfigMgr.getConverters();
//prune out converters for classes, they're not valid here
- final List converterIdList = new ArrayList();
- for (final Iterator it = list.iterator(); it.hasNext();)
+ final List<String> converterIdList = new ArrayList();
+ for (final ConverterType converter : list)
{
- ConverterType converter = (ConverterType) it.next();
ConverterIdType converterId = converter.getConverterId();
if (converterId != null)
{
@@ -213,7 +211,7 @@ public class JSFAddActionGroup {
}
}
result = new String[converterIdList.size()];
- result = (String[]) converterIdList.toArray(result);
+ result = converterIdList.toArray(result);
}
return result;
}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/AttributeValueResolverRegistryReader.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/AttributeValueResolverRegistryReader.java
index 64d045b8c..5e171d1df 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/AttributeValueResolverRegistryReader.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/AttributeValueResolverRegistryReader.java
@@ -34,28 +34,8 @@ public class AttributeValueResolverRegistryReader extends
IJMTConstants.EXTENSION_POINT_PAGEDESIGNER,
"attributeValueResolver", //$NON-NLS-1$
"class", //$NON-NLS-1$
- new CanonicalComparatorWithPrefixExceptions<IAttributeValueResolver>()
- {
- @Override
- protected int prefixSort(
- SortableExecutableExtension<IAttributeValueResolver> o1,
- SortableExecutableExtension<IAttributeValueResolver> o2)
- {
- // if o1 is contributed by open source, sort it
- // after
- if (o1.getContributorId().startsWith("org.eclipse.jst")) //$NON-NLS-1$
- {
- return 1;
- }
- // if o2 is contributed by open source, sort o1 first
- else if (o2.getContributorId().startsWith("org.eclipse.jst")) //$NON-NLS-1$
- {
- return -1;
- }
- // otherwise, we don't care
- return 0;
- }
- });
+ new CompareOrgEclipseJstContributorsLastComparator<IAttributeValueResolver>()
+ );
}
/**

Back to the top