Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model')
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java149
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java150
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java83
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java52
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java163
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java66
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java188
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java655
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java88
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java39
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java68
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java28
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java51
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java63
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java61
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java42
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java314
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java231
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java52
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java58
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java72
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java62
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java131
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java862
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties1
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java442
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java257
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java159
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java166
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java50
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java122
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java217
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java391
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java475
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java104
35 files changed, 0 insertions, 6112 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java
deleted file mode 100644
index 50d932830..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/AbstractTagRegistry.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jst.jsf.common.internal.RunOnCompletionPattern;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-
-/**
- * The abstract registry that all implementations of ITagRegistry should
- * sub-class.
- *
- * @author cbateman
- *
- */
-public abstract class AbstractTagRegistry implements ITagRegistry
-{
- private final List<ITagRegistryListener> _listeners;
- private final AtomicBoolean _isDisposed = new AtomicBoolean(
- false);
-
- /**
- *
- */
- protected AbstractTagRegistry()
- {
- super();
- _listeners = new CopyOnWriteArrayList<ITagRegistryListener>();
- }
-
- public final void addListener(final ITagRegistryListener listener)
- {
- if (!_listeners.contains(listener))
- {
- _listeners.add(listener);
- }
- }
-
- public final void removeListener(final ITagRegistryListener listener)
- {
- _listeners.remove(listener);
- }
-
- /**
- * @param event
- */
- protected final void fireEvent(final TagRegistryChangeEvent event)
- {
- for (final ITagRegistryListener listener : _listeners)
- {
- try
- {
- listener.registryChanged(event);
- }
- catch (final Exception e)
- {
- JSFCorePlugin.log(new Exception(e),
- "During change event notification"); //$NON-NLS-1$
- }
- }
- }
-
- public abstract Collection<? extends Namespace> getAllTagLibraries();
-
- public abstract Namespace getTagLibrary(String uri);
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#isDisposed()
- */
- public final boolean isDisposed()
- {
- return _isDisposed.get();
- }
-
- /**
- *
- */
- public final void destroy()
- {
- cleanupPersistentState();
- dispose();
- }
-
- /**
- * Called by destroy before it calls dispose. Sub-class should
- * invalidate, and ideally delete, any persistent state.
- *
- * NOTE: DO NOT call dispose functionality from this call. The framework
- * will call dispose() immediately after cleanupPersistentState.
- */
- protected abstract void cleanupPersistentState();
-
- /**
- * Must be factories or caches when disposing the registry. Instances
- * must implement doDispose to provide their specific disposal operations.
- */
- public final void dispose()
- {
- // latch on the isDisposed flag so this block can only ever
- // execute once
- if (_isDisposed.compareAndSet(false, true))
- {
- fireEvent(new TagRegistryChangeEvent(this,
- TagRegistryChangeEvent.EventType.REGISTRY_DISPOSED));
- doDispose();
- }
- }
-
- /**
- * Implement with instance specific disposal operations. Do do not fire
- * the REGISTRY_DISPOSED event from this method (it is done in dispose.
- *
- * Implementer must assume that this method be called at most once and that
- * it is error to access the registry instance after it is called
- */
- protected abstract void doDispose();
-
- public final void refresh(final Runnable runAfter, final boolean flushCaches)
- {
- final Job refreshJob = getRefreshJob(flushCaches);
-
- final RunOnCompletionPattern runPattern = new RunOnCompletionPattern(
- refreshJob, runAfter);
- runPattern.run();
- }
-
- /**
- * @param flushCaches
- * @return a job that, when run, will perform the registry refresh. Job
- * must do any necessary synchronizing of internal state.
- */
- protected abstract Job getRefreshJob(final boolean flushCaches);
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java
deleted file mode 100644
index 7bb3dde8d..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/ITagRegistry.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EventListener;
-import java.util.EventObject;
-import java.util.List;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
-
-/**
- * A registry for tags for a given context TODO: generally tied to project, but
- * may also need a tie to specific tag-in-use type. For example, if JSPs and
- * Facelets are used at the same time?
- *
- * @author cbateman
- *
- */
-public interface ITagRegistry
-{
-
- /**
- * @return true if this registry is disposed. It is an error to use a
- * disposed registry and behaviour of such a registry is not
- * guaranteed.
- */
- public abstract boolean isDisposed();
-
- /**
- * This method may cause long-running operations to be executed. If runAfter
- * is non-null, any long running operations will schedule asynchronously on
- * a separate thread and on successful completion, runAfter will be executed
- * (no assumption should be made about what thread it is run on).
- *
- * @param runAfter
- * @param flushCaches true indicates that any cached data should be flushed.
- *
- */
- public abstract void refresh(final Runnable runAfter, final boolean flushCaches);
-
- /**
- * Callers should assume the collection is not modifiable. Implementers
- * may return a collection whose mutator operations throw exceptions.
- *
- * @return all tag libraries for a project tag registry
- */
- public abstract Collection<? extends Namespace> getAllTagLibraries();
-
- /**
- * @param uri
- * @return the tag library corresponding to uri or null if none.
- */
- public abstract Namespace getTagLibrary(final String uri);
-
- /**
- * Adds the listener to the list of objects that receive change events
- * from this tag registry instance. If listener is already in the list,
- * it will not be added again.
- *
- * @param listener
- */
- public abstract void addListener(ITagRegistryListener listener);
-
- /**
- * Remove listener from the list of objects that receive change events
- * from this tag registry instance.
- *
- * @param listener
- */
- public abstract void removeListener(ITagRegistryListener listener);
-
-
- /**
- * Marks a listener that receives tag registry change events
- *
- */
- interface ITagRegistryListener extends EventListener
- {
- /**
- * @param changeEvent
- */
- void registryChanged(final TagRegistryChangeEvent changeEvent);
- }
-
- /**
- * A change event object that communicates a single type of change to
- * a single tag registry
- *
- */
- static class TagRegistryChangeEvent extends EventObject
- {
- public enum EventType
- {
- // if the type is any of these three, then getAffectedObjects()
- // will return one or more Namespace objects that have changed.
- ADDED_NAMESPACE,
- REMOVED_NAMESPACE,
- CHANGED_NAMESPACE,
-
- // if the type is is this one, then the event is being called
- // before dispose operation on getSource().
- REGISTRY_DISPOSED
- }
- /**
- *
- */
- private static final long serialVersionUID = 6559096306615373552L;
- private final List<? extends Namespace> _affectedObjects;
- private final EventType _type;
-
- public TagRegistryChangeEvent(ITagRegistry source, EventType type)
- {
- this(source, type, Collections.EMPTY_LIST);
- }
-
- public TagRegistryChangeEvent(ITagRegistry source, EventType type,
- List<? extends Namespace> affectedObjects)
- {
- super(source);
- _affectedObjects = affectedObjects;
- _type = type;
- }
-
- @Override
- public ITagRegistry getSource()
- {
- return (ITagRegistry) super.getSource();
- }
-
- public List<? extends Namespace> getAffectedObjects()
- {
- return _affectedObjects;
- }
-
- public EventType getType()
- {
- return _type;
- }
- }
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java
deleted file mode 100644
index d0c5ecb59..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/TagRegistryFactory.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy;
-
-/**
- * Creates a tag registry for the given project. The factory may use
- * whatever mechanism it chooses and the tag registry may or may not be a
- * single instance for project.
- *
- * @author cbateman
- *
- */
-public abstract class TagRegistryFactory implements IIdentifiableStrategy<IProject, ITagRegistry, String>
-{
- private static final ITagRegistry NO_RESULT = null;
-
- private static final String ID = "org.eclipse.jst.jsf.designtime.view.model.TagRegistryFactory"; //$NON-NLS-1$
-
- /**
- * @param project
- * @return a tag registry for project. This instance may be a common
- * shared per-project singleton. The factory must ensure that the registry
- * is cleaned up if the associated project becomes inaccessible (see IProject.isAccessible).
- * Return null if none.
- *
- * @throws TagRegistryFactoryException
- */
- public abstract ITagRegistry createTagRegistry(final IProject project) throws TagRegistryFactoryException;
-
- /**
- * Allow
- *
- * @param project
- * @return true if an instance of ITagRegistry already exists for project
- */
- public abstract boolean isInstance(final IProject project);
-
- public final ITagRegistry getNoResult()
- {
- return NO_RESULT;
- }
-
- public final ITagRegistry perform(IProject project) throws Exception
- {
- return createTagRegistry(project);
- }
-
- public String getId()
- {
- return ID;
- }
-
- /**
- * Wraps exceptions generated by trying to create a tag registry
- */
- public static class TagRegistryFactoryException extends Exception
- {
- /**
- * serializable id
- */
- private static final long serialVersionUID = 1361229535611361339L;
-
- /**
- * @param cause
- */
- public TagRegistryFactoryException(Throwable cause)
- {
- super("Problem during tag registry construction", cause); //$NON-NLS-1$
- }
-
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java
deleted file mode 100644
index 637ec963c..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/AbstractTagResolvingStrategy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-
-/**
- * Implements the tag resolving strategy.
- *
- * @author cbateman
- *
- * @param <TLDELEMENT>
- * @param <IDTYPE>
- */
-public abstract class AbstractTagResolvingStrategy<TLDELEMENT, IDTYPE>
- implements ITagResolvingStrategy<TLDELEMENT, IDTYPE>
-{
- private final static ITagElement NOT_FOUND_INDICATOR = null;
-
- public ITagElement getNotFoundIndicator()
- {
- return NOT_FOUND_INDICATOR;
- }
-
- public abstract ITagElement resolve(TLDELEMENT element);
-
- public abstract IDTYPE getId();
-
- /**
- * Must always be the same as resolve.
- */
- public final ITagElement perform(TLDELEMENT element)
- {
- return resolve(element);
- }
-
- /**
- * Must always be the same as getNotFoundIndicator.
- */
- public final ITagElement getNoResult()
- {
- return getNotFoundIndicator();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java
deleted file mode 100644
index 1235398ff..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CMNodeNamedMapAdapter.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Cameron Bateman - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.UnknownAttributeException;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
-
-/**
- * Adapts TLDDocument attributes to a simple map of ITagAttributeHandler. Map is
- * unmodifiable.
- *
- * @author cbateman
- *
- */
-public class CMNodeNamedMapAdapter implements
- Map<String, ITagAttributeHandler>
-{
- /**
- * serializable id
- */
- private static final long serialVersionUID = -4188412823197830484L;
- private transient final TLDElementDeclaration _tldElement;
- private transient final IAttributeAdvisor _advisor;
- private transient final AtomicBoolean _isInitialized = new AtomicBoolean(false);
- private final Map<String, ITagAttributeHandler> _cache;
-
- /**
- * @param tldDoc
- * @param advisor
- */
- public CMNodeNamedMapAdapter(final TLDElementDeclaration tldDoc,
- final IAttributeAdvisor advisor)
- {
- _tldElement = tldDoc;
- _advisor = advisor;
- _cache = new HashMap<String, ITagAttributeHandler>();
- }
-
- public boolean containsKey(Object key)
- {
- ensureAllAttributes();
- return _cache.containsKey(key);
- }
-
- public boolean containsValue(Object value)
- {
- ensureAllAttributes();
- return _cache.containsValue(value);
- }
-
- public Set<java.util.Map.Entry<String, ITagAttributeHandler>> entrySet()
- {
- ensureAllAttributes();
- return _cache.entrySet();
- }
-
-
- public ITagAttributeHandler get(Object key)
- {
- if (key instanceof String)
- {
- return getOrCreateAttribute((String) key);
- }
- return null;
- }
-
- public boolean isEmpty()
- {
- return size() == 0;
- }
-
- public Set<String> keySet()
- {
- ensureAllAttributes();
- return Collections.unmodifiableSet(_cache.keySet());
- }
-
- public int size()
- {
- if (_tldElement != null)
- {
- return _tldElement.getAttributes().getLength();
- }
- return _cache.size();
- }
-
- public Collection<ITagAttributeHandler> values()
- {
- ensureAllAttributes();
- return Collections.unmodifiableCollection(_cache.values());
- }
-
- private synchronized ITagAttributeHandler getOrCreateAttribute(final String name)
- {
- ITagAttributeHandler tagAttr = _cache.get(name);
-
- if (tagAttr == null)
- {
- try
- {
- tagAttr = _advisor.createAttributeHandler(name);
- _cache.put(name, tagAttr);
- }
- catch (UnknownAttributeException e)
- {
- JSFCorePlugin.log(e, "Trying to get attribute for "+name); //$NON-NLS-1$
- }
- }
-
- return tagAttr;
- }
-
- private void ensureAllAttributes()
- {
- if (_isInitialized.compareAndSet(false, true))
- {
- for (final Iterator it = _tldElement.getAttributes().iterator(); it.hasNext();)
- {
- final CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) it.next();
- getOrCreateAttribute(attrDecl.getAttrName());
- }
- }
- }
-
- public void clear()
- {
- throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$
- }
-
- public ITagAttributeHandler put(String key, ITagAttributeHandler value)
- {
- throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$
- }
-
- public void putAll(Map<? extends String, ? extends ITagAttributeHandler> t)
- {
- throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$
- }
-
- public ITagAttributeHandler remove(Object key)
- {
- throw new UnsupportedOperationException("Cannot modify map"); //$NON-NLS-1$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java
deleted file mode 100644
index 8037ff1a2..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/CompositeTagResolvingStrategy.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.internal.policy.IIdentifiable;
-import org.eclipse.jst.jsf.common.internal.policy.IIteratorPolicy;
-import org.eclipse.jst.jsf.common.internal.strategy.IteratorPolicyBasedStrategyComposite;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.designtime.internal.Messages;
-
-/**
- * @author cbateman
- *
- * @param <TLDELEMENT>
- */
-public class CompositeTagResolvingStrategy<TLDELEMENT>
- extends
- IteratorPolicyBasedStrategyComposite<TLDELEMENT, ITagElement, ITagElement, String, ITagResolvingStrategy<TLDELEMENT, String>>
- implements IIdentifiable<String>,
- ITagResolvingStrategy<TLDELEMENT, String>
-{
- private static final String ID = "org.eclipse.jst.jsf.designtime.CompositeTagResolvingStrategy"; //$NON-NLS-1$
-
- /**
- * @param policy
- *
- */
- public CompositeTagResolvingStrategy(final IIteratorPolicy<String> policy)
- {
- super(policy);
- }
-
- public final String getId()
- {
- return ID;
- }
-
- public final String getDisplayName()
- {
- return Messages.CompositeTagResolvingStrategy_DisplayName;
- }
-
- @Override
- public ITagElement getNoResult()
- {
- return null;
- }
-
- public final ITagElement getNotFoundIndicator()
- {
- return getNoResult();
- }
-
- public final ITagElement resolve(TLDELEMENT element)
- {
- return perform(element);
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java
deleted file mode 100644
index b0226e3e5..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultJSPTagResolver.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.common.dom.TagIdentifier;
-import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.types.TypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType;
-import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory;
-import org.eclipse.jst.jsf.designtime.internal.Messages;
-import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataLoader;
-import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataMapper;
-import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagMapping;
-import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.TagToViewObjectMapping;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-import org.osgi.framework.Version;
-
-/**
- * ** TEMPORARY CLASS UNTIL META-DATA STRATEGY IS AVAILABLE **
- *
- * @author cbateman
- *
- */
-public class DefaultJSPTagResolver extends JSPTagResolvingStrategy
-{
- /**
- * strategy id
- */
- public final static String ID = "org.eclipse.jst.jsf.metadata.DefaultJSPTagResolver"; //$NON-NLS-1$
- /**
- * displayable nameb
- */
- public final static String DISPLAY_NAME = Messages.DefaultJSPTagResolver_DisplayName;
-
- private final ViewMetadataLoader _loader;
- private final ViewMetadataMapper _mapper;
-
- /**
- * @return the descriptor for this resolver strategy
- */
- public static StrategyDescriptor createDescriptor()
- {
- return new StrategyDescriptor(ID, DISPLAY_NAME);
- }
-
- /**
- * @param project
- */
- public DefaultJSPTagResolver(final IProject project)
- {
- _loader = new ViewMetadataLoader(project);
- _mapper = new ViewMetadataMapper();
- }
-
- @Override
- public ITagElement resolve(final TLDElementDeclaration elementDecl)
- {
- // final IProjectFacetVersion version = JSFAppConfigUtils
- // .getProjectFacet(_project);
- // final String versionAsString = version.getVersionString();
- // final JSFVersion jsfVersion = JSFVersion.valueOfString(versionAsString);
-
- final TagIdentifier tagId = TagIdentifierFactory
- .createTLDTagWrapper(elementDecl);
- // final DefaultTagTypeInfo defaultTagTypeInfo = new DefaultTagTypeInfo();
- final TagMapping mapping = _loader.getTagToViewMapping(tagId);
-
- TypeInfo elementType = null;
- if (mapping != null)
- {
- elementType = findTypeInfo(mapping, "1.1", null); //$NON-NLS-1$
- }
-
- if (elementType instanceof ComponentTypeInfo)
- {
- return new TLDComponentTagElement(elementDecl,
- (ComponentTypeInfo) elementType, new MetadataAttributeAdvisor(tagId, _loader));
- }
- else if (elementType instanceof ConverterTypeInfo)
- {
- return new TLDConverterTagElement(elementDecl,
- (ConverterTypeInfo) elementType, new MetadataAttributeAdvisor(tagId, _loader));
- }
- else if (elementType instanceof ValidatorTypeInfo)
- {
- return new TLDValidatorTagElement(elementDecl,
- (ValidatorTypeInfo) elementType, new MetadataAttributeAdvisor(tagId, _loader));
- }
- else if (elementType instanceof TagHandlerType)
- {
- return new TLDTagHandlerElement(elementDecl,
- (TagHandlerType) elementType, new MetadataAttributeAdvisor(tagId, _loader));
- }
- else if (DefaultTagTypeInfo.isDefaultLib(tagId.getUri()))
- {
- return new TLDTagElement(elementDecl, new NullAttributeAdvisor());
- }
-
- // not found
- return null;
- }
-
- private TypeInfo findTypeInfo(final TagMapping mapping, final String jsfVersion,
- final String libVersion)
- {
- final EList list = mapping.getVersionedTagToViewMappings();
-
- FIND_BY_VERSION : for (final Iterator<?> it = list.iterator(); it.hasNext();)
- {
- Object obj = it.next();
-
- if (obj instanceof TagToViewObjectMapping)
- {
- final TagToViewObjectMapping viewMapping = (TagToViewObjectMapping) obj;
-
- final String minJsfVersionString = viewMapping.getMinJSFVersion();
- if (minJsfVersionString != null)
- {
- try
- {
- final Version version = new Version(jsfVersion);
- final Version minVersion = Version.parseVersion(minJsfVersionString);
-
- if (version.compareTo(minVersion) < 0)
- {
- // my version is less than the minimum specified
- // by this meta-data
- continue FIND_BY_VERSION;
- }
- }
- catch (final IllegalArgumentException iae)
- {
- continue FIND_BY_VERSION;
- }
- }
- final String minLibVersionString = viewMapping.getMinLibraryVersion();
- if (libVersion != null && minLibVersionString != null)
- {
- try
- {
- final Version version = new Version(libVersion);
- final Version minLibVersion = Version.parseVersion(minLibVersionString);
-
- if (version.compareTo(minLibVersion) < 0)
- {
- // my lib version is less than the minimum specified
- // by the meta-data
- continue FIND_BY_VERSION;
- }
- }
- catch (IllegalArgumentException iae)
- {
- continue FIND_BY_VERSION;
- }
- }
- return _mapper.mapToFrameworkData(viewMapping.getTypeInfo());
- }
- }
- return null;
- }
-
- @Override
- public String getId()
- {
- return ID;
- }
-
- public String getDisplayName()
- {
- return DISPLAY_NAME;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java
deleted file mode 100644
index 6853c82a9..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/DefaultTagTypeInfo.java
+++ /dev/null
@@ -1,655 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jst.jsf.common.dom.TagIdentifier;
-import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.types.TypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType;
-import org.eclipse.jst.jsf.core.JSFVersion;
-import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants;
-import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants;
-
-/**
- * Hard-coded TypeInfo for default core and html JSF tags.
- *
- * @author cbateman
- *
- */
-public final class DefaultTagTypeInfo
-{
- private final static Set<String> URI_IS_A_JSF_LIB;
-
- static
- {
- final Set<String> libs = new HashSet<String>();
- libs.add(ITLDConstants.URI_JSF_CORE);
- libs.add(ITLDConstants.URI_JSF_HTML);
- URI_IS_A_JSF_LIB = Collections.unmodifiableSet(libs);
- }
-
- /**
- * @param tagId
- * @param jsfVersion
- * @return a type info for the tag id in jsf version or null if none.
- */
- public TypeInfo getTypeInfo(final TagIdentifier tagId,
- final JSFVersion jsfVersion)
- {
-
- switch (jsfVersion)
- {
- case V1_0:
- case V1_1:
- return JSF11_ELEMENTS.get(tagId);
-
- case V1_2:
- return JSF12_ELEMENTS.get(tagId);
-
- default:
- return null;
- }
- }
-
- /**
- * @param uri
- * @return true if uri is covered by this class
- */
- public static boolean isDefaultLib(final String uri)
- {
- return URI_IS_A_JSF_LIB.contains(uri);
- }
-
- private static final ComponentTypeInfo COMPINFO_PARAM = new ComponentTypeInfo(
- "javax.faces.Parameter", //$NON-NLS-1$
- "javax.faces.component.UIParameter", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Parameter", //$NON-NLS-1$
- null);
-
- private static final ComponentTypeInfo COMPINFO_SELECTITEM = new ComponentTypeInfo(
- "javax.faces.SelectItem", //$NON-NLS-1$
- "javax.faces.component.UISelectItem", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectItem", //$NON-NLS-1$
- null);
-
- private static final ComponentTypeInfo COMPINFO_SELECTITEMS = new ComponentTypeInfo(
- "javax.faces.SelectItems", //$NON-NLS-1$
- "javax.faces.component.UISelectItems", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectItems", //$NON-NLS-1$
- null);
-
- private static final ComponentTypeInfo COMPINFO_SUBVIEW = new ComponentTypeInfo(
- "javax.faces.NamingContainer", //$NON-NLS-1$
- "javax.faces.component.UINamingContainer", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.NamingContainer", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.NamingContainer", //$NON-NLS-1$
- null);
-
- private static final ComponentTypeInfo COMPINFO_VERBATIM = new ComponentTypeInfo(
- "javax.faces.Output", //$NON-NLS-1$
- "javax.faces.component.UIOutput", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Output", //$NON-NLS-1$
- "javax.faces.Text"); //$NON-NLS-1$
-
- private static final ComponentTypeInfo COMPINFO_VIEW = new ComponentTypeInfo(
- "javax.faces.ViewRoot", //$NON-NLS-1$
- "javax.faces.component.UIViewRoot", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.ViewRoot", //$NON-NLS-1$
- null);
-
- // expected type info for jsf/html components
- private static final ComponentTypeInfo COMPINFO_COLUMN = new ComponentTypeInfo(
- "javax.faces.Column", //$NON-NLS-1$
- "javax.faces.component.UIColumn", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder" }, //$NON-NLS-1$
- "javax.faces.Column", //$NON-NLS-1$
- null);
- private static final ComponentTypeInfo COMPINFO_COMMAND = new ComponentTypeInfo(
- "javax.faces.HtmlCommandButton", //$NON-NLS-1$
- "javax.faces.component.html.HtmlCommandButton", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UICommand", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.ActionSource", //$NON-NLS-1$
- "javax.faces.component.StateHolder" }, //$NON-NLS-1$
- "javax.faces.Command", //$NON-NLS-1$
- "javax.faces.Button"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_COMMANDLINK = new ComponentTypeInfo(
- "javax.faces.HtmlCommandLink", //$NON-NLS-1$
- "javax.faces.component.html.HtmlCommandLink", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UICommand", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.ActionSource", //$NON-NLS-1$
- "javax.faces.component.StateHolder" }, //$NON-NLS-1$
- "javax.faces.Command", //$NON-NLS-1$
- "javax.faces.Link"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_DATATABLE = new ComponentTypeInfo(
- "javax.faces.HtmlDataTable", //$NON-NLS-1$
- "javax.faces.component.html.HtmlDataTable", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIData", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.NamingContainer", //$NON-NLS-1$
- "javax.faces.component.StateHolder" }, //$NON-NLS-1$
- "javax.faces.Data", //$NON-NLS-1$
- "javax.faces.Table"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_FORM = new ComponentTypeInfo(
- "javax.faces.HtmlForm", //$NON-NLS-1$
- "javax.faces.component.html.HtmlForm", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIForm", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.NamingContainer", //$NON-NLS-1$
- "javax.faces.component.StateHolder" }, //$NON-NLS-1$
- "javax.faces.Form", //$NON-NLS-1$
- "javax.faces.Form"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_GRAPHIC = new ComponentTypeInfo(
- "javax.faces.HtmlGraphicImage", //$NON-NLS-1$
- "javax.faces.component.html.HtmlGraphicImage", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIGraphic", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Graphic", //$NON-NLS-1$
- "javax.faces.Image"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_HIDDEN = new ComponentTypeInfo(
- "javax.faces.HtmlInputHidden", //$NON-NLS-1$
- "javax.faces.component.html.HtmlInputHidden", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Input", //$NON-NLS-1$
- "javax.faces.Hidden"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SECRET = new ComponentTypeInfo(
- "javax.faces.HtmlInputSecret", //$NON-NLS-1$
- "javax.faces.component.html.HtmlInputSecret", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder" }, //$NON-NLS-1$
- "javax.faces.Input", //$NON-NLS-1$
- "javax.faces.Secret"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_INPUTTEXT = new ComponentTypeInfo(
- "javax.faces.HtmlInputText", //$NON-NLS-1$
- "javax.faces.component.html.HtmlInputText", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object" }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder" }, //$NON-NLS-1$
- "javax.faces.Input", //$NON-NLS-1$
- "javax.faces.Text"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_INPUTTEXTAREA = new ComponentTypeInfo(
- "javax.faces.HtmlInputTextarea", //$NON-NLS-1$
- "javax.faces.component.html.HtmlInputTextarea", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Input", //$NON-NLS-1$
- "javax.faces.Textarea"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_MESSAGE = new ComponentTypeInfo(
- "javax.faces.HtmlMessage", //$NON-NLS-1$
- "javax.faces.component.html.HtmlMessage", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIMessage", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Message", //$NON-NLS-1$
- "javax.faces.Message"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_MESSAGES = new ComponentTypeInfo(
- "javax.faces.HtmlMessages", //$NON-NLS-1$
- "javax.faces.component.html.HtmlMessages", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIMessages", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Messages", //$NON-NLS-1$
- "javax.faces.Messages"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_OUTPUTFORMAT = new ComponentTypeInfo(
- "javax.faces.HtmlOutputFormat", //$NON-NLS-1$
- "javax.faces.component.html.HtmlOutputFormat", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIOutput", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Output", //$NON-NLS-1$
- "javax.faces.Format"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_OUTPUTLABEL = new ComponentTypeInfo(
- "javax.faces.HtmlOutputLabel", //$NON-NLS-1$
- "javax.faces.component.html.HtmlOutputLabel", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIOutput", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Output", //$NON-NLS-1$
- "javax.faces.Label"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_OUTPUTLINK = new ComponentTypeInfo(
- "javax.faces.HtmlOutputLink", //$NON-NLS-1$
- "javax.faces.component.html.HtmlOutputLink", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIOutput", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Output", //$NON-NLS-1$
- "javax.faces.Link"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_OUTPUTTEXT = new ComponentTypeInfo(
- "javax.faces.HtmlOutputText", //$NON-NLS-1$
- "javax.faces.component.html.HtmlOutputText", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIOutput", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Output", //$NON-NLS-1$
- "javax.faces.Text"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_PANELGRID = new ComponentTypeInfo(
- "javax.faces.HtmlPanelGrid", //$NON-NLS-1$
- "javax.faces.component.html.HtmlPanelGrid", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIPanel", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Panel", //$NON-NLS-1$
- "javax.faces.Grid"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_PANELGROUP = new ComponentTypeInfo(
- "javax.faces.HtmlPanelGroup", //$NON-NLS-1$
- "javax.faces.component.html.HtmlPanelGroup", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UIPanel", //$NON-NLS-1$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- { "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.Panel", //$NON-NLS-1$
- "javax.faces.Group"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SELECTBOOLEANCHECKBOX = new ComponentTypeInfo(
- "javax.faces.HtmlSelectBooleanCheckbox", //$NON-NLS-1$
- "javax.faces.component.html.HtmlSelectBooleanCheckbox", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UISelectBoolean", //$NON-NLS-1$
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectBoolean", //$NON-NLS-1$
- "javax.faces.Checkbox"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SELECTMANYCHECKBOX = new ComponentTypeInfo(
- "javax.faces.HtmlSelectManyCheckbox", //$NON-NLS-1$
- "javax.faces.component.html.HtmlSelectManyCheckbox", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UISelectMany", //$NON-NLS-1$
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectMany", //$NON-NLS-1$
- "javax.faces.Checkbox"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SELECTMANYLISTBOX = new ComponentTypeInfo(
- "javax.faces.HtmlSelectManyListbox", //$NON-NLS-1$
- "javax.faces.component.html.HtmlSelectManyListbox", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UISelectMany", //$NON-NLS-1$
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectMany", //$NON-NLS-1$
- "javax.faces.Listbox"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SELECTMANYMENU = new ComponentTypeInfo(
- "javax.faces.HtmlSelectManyMenu", //$NON-NLS-1$
- "javax.faces.component.html.HtmlSelectManyMenu", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UISelectMany", //$NON-NLS-1$
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectMany", //$NON-NLS-1$
- "javax.faces.Menu"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SELECTONELISTBOX = new ComponentTypeInfo(
- "javax.faces.HtmlSelectOneListbox", //$NON-NLS-1$
- "javax.faces.component.html.HtmlSelectOneListbox", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UISelectOne", //$NON-NLS-1$
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectOne", //$NON-NLS-1$
- "javax.faces.Listbox"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SELECTONEMENU = new ComponentTypeInfo(
- "javax.faces.HtmlSelectOneMenu", //$NON-NLS-1$
- "javax.faces.component.html.HtmlSelectOneMenu", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UISelectOne", //$NON-NLS-1$
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectOne", //$NON-NLS-1$
- "javax.faces.Menu"); //$NON-NLS-1$
- private static final ComponentTypeInfo COMPINFO_SELECTONERADIO = new ComponentTypeInfo(
- "javax.faces.HtmlSelectOneRadio", //$NON-NLS-1$
- "javax.faces.component.html.HtmlSelectOneRadio", //$NON-NLS-1$
- new String[]
- {
- "javax.faces.component.UISelectOne", //$NON-NLS-1$
- "javax.faces.component.UIInput", "javax.faces.component.UIOutput", //$NON-NLS-1$ //$NON-NLS-2$
- "javax.faces.component.UIComponentBase", //$NON-NLS-1$
- "javax.faces.component.UIComponent", "java.lang.Object", }, //$NON-NLS-1$ //$NON-NLS-2$
- new String[]
- {
- "javax.faces.component.EditableValueHolder", //$NON-NLS-1$
- "javax.faces.component.ValueHolder", //$NON-NLS-1$
- "javax.faces.component.StateHolder", }, //$NON-NLS-1$
- "javax.faces.SelectOne", //$NON-NLS-1$
- "javax.faces.Radio"); //$NON-NLS-1$
-
- // default converters
- private static final ConverterTypeInfo CONVERTERINFO_DATETIME = new ConverterTypeInfo(
- "javax.faces.convert.DateTimeConverter", //$NON-NLS-1$
- "javax.faces.DateTime"); //$NON-NLS-1$
-
- private static final ConverterTypeInfo CONVERTERINFO_NUMBER = new ConverterTypeInfo(
- "javax.faces.convert.NumberConverter", //$NON-NLS-1$
- "javax.faces.Number"); //$NON-NLS-1$
-
- // default validators
- private static final ValidatorTypeInfo VALIDATORINFO_DOUBLERANGE = new ValidatorTypeInfo(
- "javax.faces.validator.DoubleRangeValidator", //$NON-NLS-1$
- "javax.faces.DoubleRange"); //$NON-NLS-1$
-
- private static final ValidatorTypeInfo VALIDATORINFO_LENGTH = new ValidatorTypeInfo(
- "javax.faces.validator.LengthValidator", //$NON-NLS-1$
- "javax.faces.Length"); //$NON-NLS-1$
-
- private static final ValidatorTypeInfo VALIDATORINFO_LONGRANGE = new ValidatorTypeInfo(
- "javax.faces.validator.LongRangeValidator", //$NON-NLS-1$
- "javax.faces.LongRange"); //$NON-NLS-1$
-
- private static Map<TagIdentifier, TypeInfo> JSF11_ELEMENTS;
- private static Map<TagIdentifier, TypeInfo> JSF12_ELEMENTS;
-
- static
- {
- final Map<TagIdentifier, TypeInfo> commonElements = new HashMap<TagIdentifier, TypeInfo>();
- // IJSFConstants.TAG_IDENTIFIER_PHASELISTENER);
- // IJSFConstants.TAG_IDENTIFIER_SETPROPERTYACTIONLISTENER);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_ACTIONLISTENER,
- TagHandlerType.ACTIONLISTENER);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_ATTRIBUTE,
- TagHandlerType.ATTRIBUTE);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTDATETIME,
- CONVERTERINFO_DATETIME);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTER,
- ConverterTypeInfo.UNKNOWN);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_CONVERTNUMBER,
- CONVERTERINFO_NUMBER);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_FACET, TagHandlerType.FACET);
- // elements.put(IJSFConstants.TAG_IDENTIFIER_LOADBUNDLE,
- // TagHandlerType.);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_PARAM, COMPINFO_PARAM);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTITEM,
- COMPINFO_SELECTITEM);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTITEMS,
- COMPINFO_SELECTITEMS);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SUBVIEW, COMPINFO_SUBVIEW);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATEDOUBLERANGE,
- VALIDATORINFO_DOUBLERANGE);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATELENGTH,
- VALIDATORINFO_LENGTH);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATELONGRANGE,
- VALIDATORINFO_LONGRANGE);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALIDATOR,
- ValidatorTypeInfo.UNKNOWN);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_VALUECHANGELISTENER,
- TagHandlerType.VALUECHANGELISTENER);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_VERBATIM, COMPINFO_VERBATIM);
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_VIEW, COMPINFO_VIEW);
-
- // JSF 1.2 core elements
- // none currently...
-
- // JSF 1.1/1.2 HTML tags
- // html verifier
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_COLUMN, COMPINFO_COLUMN);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_COMMANDBUTTON,
- COMPINFO_COMMAND);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_COMMANDLINK,
- COMPINFO_COMMANDLINK);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_DATA_TABLE,
- COMPINFO_DATATABLE);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_FORM, COMPINFO_FORM);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_GRAPHICIMAGE,
- COMPINFO_GRAPHIC);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTHIDDEN, COMPINFO_HIDDEN);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTSECRET, COMPINFO_SECRET);
-
- commonElements
- .put(IJSFConstants.TAG_IDENTIFIER_INPUTTEXT, COMPINFO_INPUTTEXT);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_INPUTTEXTAREA,
- COMPINFO_INPUTTEXTAREA);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_MESSAGE, COMPINFO_MESSAGE);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_MESSAGES, COMPINFO_MESSAGES);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTFORMAT,
- COMPINFO_OUTPUTFORMAT);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTLABEL,
- COMPINFO_OUTPUTLABEL);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTLINK,
- COMPINFO_OUTPUTLINK);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_OUTPUTTEXT,
- COMPINFO_OUTPUTTEXT);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_PANEL_GRID,
- COMPINFO_PANELGRID);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_PANEL_GROUP,
- COMPINFO_PANELGROUP);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTBOOLEANCHECKBOX,
- COMPINFO_SELECTBOOLEANCHECKBOX);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYCHECKBOX,
- COMPINFO_SELECTMANYCHECKBOX);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYLISTBOX,
- COMPINFO_SELECTMANYLISTBOX);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTMANYMENU,
- COMPINFO_SELECTMANYMENU);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONELISTBOX,
- COMPINFO_SELECTONELISTBOX);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONEMENU,
- COMPINFO_SELECTONEMENU);
-
- commonElements.put(IJSFConstants.TAG_IDENTIFIER_SELECTONERADIO,
- COMPINFO_SELECTONERADIO);
-
- JSF11_ELEMENTS = Collections.unmodifiableMap(commonElements);
-
- JSF12_ELEMENTS = Collections
- .unmodifiableMap(new HashMap<TagIdentifier, TypeInfo>(commonElements));
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java
deleted file mode 100644
index f473ab312..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/IAttributeAdvisor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Cameron Bateman - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagAttributeHandler;
-
-/**
- * @author cbateman
- *
- */
-public interface IAttributeAdvisor
-{
-
- /**
- * @param name
- * @return a tag attribute handler for the name.
- * @throws UnknownAttributeException if name does not match a known attribute.
- */
- ITagAttributeHandler createAttributeHandler(String name) throws UnknownAttributeException;
-
- /**
- * @author cbateman
- *
- */
- public static class NullAttributeAdvisor implements IAttributeAdvisor
- {
- public ITagAttributeHandler createAttributeHandler(String name)
- throws UnknownAttributeException
- {
- return new TagAttributeHandler(null, name, false);
- }
- }
-
- /**
- * Indicates an unknown attribute was requested or encountered
- * @author cbateman
- *
- */
- public static class UnknownAttributeException extends Exception
- {
- /**
- *
- */
- private static final long serialVersionUID = -988838913707929315L;
-
- /**
- *
- */
- public UnknownAttributeException()
- {
- super();
- }
-
- /**
- * @param message
- * @param cause
- */
- public UnknownAttributeException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public UnknownAttributeException(String message)
- {
- super(message);
- }
-
- /**
- * @param cause
- */
- public UnknownAttributeException(Throwable cause)
- {
- super(cause);
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java
deleted file mode 100644
index 4befb221e..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/ITagResolvingStrategy.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.internal.strategy.IIdentifiableStrategy;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-
-/**
- * Describes an algorithm that can produce ITagElements from <TLD> objects.
- *
- * @author cbateman
- * @param <TLDELEMENT> the object type that describes a tag library.
- * @param <IDTYPE>
- *
- */
-public interface ITagResolvingStrategy<TLDELEMENT, IDTYPE> extends
- IIdentifiableStrategy<TLDELEMENT, ITagElement, IDTYPE>
-{
- /**
- * @param element
- * @return a new tag element or {@link #getNotFoundIndicator()} if not found
- */
- ITagElement resolve(TLDELEMENT element);
-
- /**
- * @return the ITagElement (may be null) that indicates that
- * resolve(TLDELEMENT) could not resolve a tag. The return
- * must be testable with standard "==" operator and not equals().
- */
- ITagElement getNotFoundIndicator();
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java
deleted file mode 100644
index 8f2235db6..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/JSPTagResolvingStrategy.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * A strategy for resolving JSP TLDs.
- *
- * @author cbateman
- *
- */
-public abstract class JSPTagResolvingStrategy extends
- AbstractTagResolvingStrategy<TLDElementDeclaration, String>
-{
- @Override
- public abstract ITagElement resolve(TLDElementDeclaration element);
-
- public abstract String getId();
-
- public abstract String getDisplayName();
-
- /**
- * A descriptor for JSP tag resolving strategies
- *
- * @author cbateman
- *
- */
- public final static class StrategyDescriptor
- {
- private final String _id;
- private final String _displayName;
-
- /**
- * @param id
- * @param displayName
- */
- public StrategyDescriptor(final String id, final String displayName)
- {
- _id = id;
- _displayName = displayName;
- }
-
- /**
- * @return the id of the strategy
- */
- public String getId()
- {
- return _id;
- }
- /**
- * @return the human-readable displayable name of the strategy
- */
- public String getDisplayName()
- {
- return _displayName;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java
deleted file mode 100644
index 9d3dcee38..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/Messages.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * NLS message getter.
- *
- * @author cbateman
- *
- */
-public class Messages extends NLS
-{
- private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.designtime.internal.view.model.jsp.messages"; //$NON-NLS-1$
- /**
- * see messages.properties
- */
- public static String UnresolvedJSPTagResolvingStrategy_1;
- static
- {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages()
- {
- // no external instantiation
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java
deleted file mode 100644
index c85ec8a28..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/MetadataAttributeAdvisor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Cameron Bateman - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.dom.TagIdentifier;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ComponentPropertyHandler;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagAttributeHandler;
-import org.eclipse.jst.jsf.designtime.internal.view.mapping.ViewMetadataLoader;
-import org.eclipse.jst.jsf.designtime.internal.view.mapping.viewmapping.AttributeToPropertyMapping;
-
-/* package */class MetadataAttributeAdvisor implements IAttributeAdvisor
-{
- private final TagIdentifier _tagId;
- private final ViewMetadataLoader _loader;
-
- public MetadataAttributeAdvisor(final TagIdentifier tagId,
- final ViewMetadataLoader loader)
- {
- _tagId = tagId;
- _loader = loader;
- }
-
- public ITagAttributeHandler createAttributeHandler(final String name)
- throws UnknownAttributeException
- {
- final AttributeToPropertyMapping mapping = _loader.getAttributeMapping(
- _tagId, name);
- if (mapping != null)
- {
- final String customHandler = mapping.getCustomConversionFactoryId();
- final boolean isELAllowed = mapping.isElAllowed();
- final String propertyName = mapping.getPropertyName();
- if (propertyName != null)
- {
- return new ComponentPropertyHandler(customHandler, name,
- isELAllowed, propertyName);
- }
- return new TagAttributeHandler(customHandler, name, isELAllowed);
- }
- return new TagAttributeHandler(null, name, false);
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java
deleted file mode 100644
index 416bc1638..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDComponentTagElement.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IComponentTagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-
-
-/**
- * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF UIComponent
- * @author cbateman
- *
- */
-public class TLDComponentTagElement extends TLDJSFTagElement implements
-IComponentTagElement
-{
- /**
- *
- */
- private static final long serialVersionUID = -6479445622102799425L;
- private final ComponentTypeInfo _componentTypeInfo;
-
- /**
- * @param elementDecl
- * @param componentTypeInfo
- * @param advisor
- */
- public TLDComponentTagElement(final TLDElementDeclaration elementDecl
- , final ComponentTypeInfo componentTypeInfo, final IAttributeAdvisor advisor)
- {
- super(elementDecl, advisor);
- _componentTypeInfo = componentTypeInfo;
- }
-
- public ComponentTypeInfo getComponent()
- {
- return _componentTypeInfo;
- }
-
- @Override
- public TagType getType()
- {
- return TagType.COMPONENT;
- }
-
- @Override
- public String toString()
- {
- final String attributes = constructAttributesString();
- return _componentTypeInfo.toString() +
- (!"".equals(attributes) ? "\n" + attributes : ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java
deleted file mode 100644
index 257a6f479..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDConverterTagElement.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IConverterTagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF Converter
- *
- * @author cbateman
- *
- */
-public class TLDConverterTagElement extends TLDJSFTagElement implements IConverterTagElement
-{
- /**
- *
- */
- private static final long serialVersionUID = 2854457220470229847L;
- private final ConverterTypeInfo _converterTypeInfo;
-
- /**
- * @param elementDecl
- * @param converterTypeInfo
- * @param advisor
- */
- public TLDConverterTagElement(final TLDElementDeclaration elementDecl, final ConverterTypeInfo converterTypeInfo, final IAttributeAdvisor advisor)
- {
- super(elementDecl, advisor);
- _converterTypeInfo = converterTypeInfo;
- }
-
- @Override
- public TagType getType()
- {
- return TagType.CONVERTER;
- }
-
- /**
- * @return the type info for this converter
- */
- public final ConverterTypeInfo getConverter()
- {
- return _converterTypeInfo;
- }
-
- @Override
- public String toString()
- {
- return _converterTypeInfo.toString();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java
deleted file mode 100644
index 58f88a865..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDJSFTagElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * A JSF tag element.
- *
- * @author cbateman
- *
- */
-public abstract class TLDJSFTagElement extends TLDTagElement implements
- IJSFTagElement
-{
- /**
- *
- */
- private static final long serialVersionUID = -7629153104201317346L;
-
- /**
- * @param elementDecl
- * @param advisor
- */
- public TLDJSFTagElement(final TLDElementDeclaration elementDecl
- , final IAttributeAdvisor advisor)
- {
- super(elementDecl, advisor);
- }
-
- public abstract TagType getType();
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java
deleted file mode 100644
index 043ffe7d5..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDNamespace.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.SerializableTLDNamespace;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
-
-/**
- * Represents a JSP tag library namespace
- *
- * @author cbateman
- *
- */
-public class TLDNamespace extends Namespace
-{
- /**
- *
- */
- private static final long serialVersionUID = 9206460825737988441L;
- private TLDNamespaceData _tldData;
-
- /**
- * @param tldDoc
- * @param tagResolver
- */
- public TLDNamespace(
- final TLDDocument tldDoc,
- final ITagResolvingStrategy<TLDElementDeclaration, String> tagResolver)
- {
- _tldData = new DocumentTLDNamespaceData(tldDoc, tagResolver);
- }
-
- @Override
- public final String getDisplayName()
- {
- return _tldData.getDisplayName();
- }
-
- @Override
- public final String getNSUri()
- {
- return _tldData.getUri();
- }
-
- @Override
- public boolean isInitialized()
- {
- return _tldData.isInitialized();
- }
-
- public final ITagElement getViewElement(final String name)
- {
- // // bias the table small if this creates it
- // final Map<String, ITagElement> tags = getOrCreateMap(3);
- //
- // return _tldData.getOrCreateTagElement(name, tags);
- return _tldData.getViewElement(name);
- }
-
- @Override
- public final Collection<? extends ITagElement> getViewElements()
- {
- return Collections.unmodifiableCollection(_tldData.getAllViewElements().values());
- }
-
- /**
- * Differs from getViewElements because it won't include those elements
- * that haven't been lazily loaded.
- *
- * @return an unmodifiable map of all elements currently calculated for
- * this namespaces
- */
- public final Map<String, ITagElement> getCurrentElements()
- {
- return Collections.unmodifiableMap(_tldData.getCurrentElements());
- }
-
- @Override
- public final boolean hasViewElements()
- {
- return _tldData.getNumTags() > 0;
- }
-
-
- private Object writeReplace()
- {
- return new SerializableTLDNamespace(this);
- }
-
- private static class DocumentTLDNamespaceData extends TLDNamespaceData
- {
- /**
- *
- */
- private static final long serialVersionUID = -1098872687238068584L;
- private final transient TLDDocument _tldDoc;
- private final transient ITagResolvingStrategy<TLDElementDeclaration, String> _tagResolver;
- private final transient ILock _tagMapReadWriteLock;
- // should only be accessed directly in getOrCreateMap;
- private Map<String, ITagElement> _tags; // lazy init in initializeTags
-
- public DocumentTLDNamespaceData(
- final TLDDocument tldDoc,
- final ITagResolvingStrategy<TLDElementDeclaration, String> tagResolver)
- {
- _tldDoc = tldDoc;
- _tagResolver = tagResolver;
- _tagMapReadWriteLock = Job.getJobManager().newLock();
- }
-
- @Override
- public String getDisplayName()
- {
- String displayName = _tldDoc.getDisplayName();
- if (displayName == null || "".equals(displayName.trim())) //$NON-NLS-1$
- {
- displayName = getUri();
- }
- return displayName;
- }
-
- @Override
- public String getUri()
- {
- return _tldDoc.getUri();
- }
-
- @Override
- public int getNumTags()
- {
- return _tldDoc.getElements().getLength();
- }
-
- private ITagElement createTagElement(final String name)
- {
- CMNode cmNode = _tldDoc.getElements().getNamedItem(name);
- ITagElement tagElement = null;
- if (cmNode instanceof TLDElementDeclaration)
- {
- tagElement = _tagResolver
- .resolve((TLDElementDeclaration) cmNode);
-
- if (tagElement == _tagResolver.getNotFoundIndicator())
- {
- // the not-found indicator may not be null.
- tagElement = null;
- }
- }
- return tagElement;
- }
-
- public final Map<String, ITagElement> getAllViewElements()
- {
- final CMNamedNodeMap elementMap = _tldDoc.getElements();
- final Map<String, ITagElement> tags = getOrCreateMap(elementMap
- .getLength());
- if (!isInitialized())
- {
- // if we create the table with this call, bias the table size
- // to be 1 bigger than the number of tags, since we know if it's
- // smaller, it'll cause at least one buffer resize
-
-
- for (int i = 0; i < elementMap.getLength(); i++)
- {
- final CMNode cmNode = elementMap.item(i);
- getViewElement(cmNode.getNodeName());
- }
- }
- return tags;
- }
-
- public ITagElement getViewElement(final String name)
- {
- ITagElement tagElement = null;
-
- _tagMapReadWriteLock.acquire();
- final Map<String, ITagElement> tags = getOrCreateMap(_tldDoc.getElements().getLength());
- try
- {
- tagElement = tags.get(name);
-
- if (tagElement == null)
- {
- tagElement = createTagElement(name);
-
- if (tagElement != null)
- {
- tags.put(tagElement.getName(), tagElement);
- }
- }
- }
- finally
- {
- _tagMapReadWriteLock.release();
- }
-
- return tagElement;
- }
-
- /**
- * mapSizeHint will be used
- *
- * @param mapSizeHint
- * @return the map
- */
- private synchronized Map<String, ITagElement> getOrCreateMap(
- final int mapSizeHint)
- {
- if (_tags == null)
- {
- final float loadFactor = 0.75f;
- final int initSize = ((int) (mapSizeHint / loadFactor)) + 1;
- _tags = Collections
- .synchronizedMap(new HashMap<String, ITagElement>(
- initSize));
- }
- return _tags;
- }
-
- @Override
- public boolean isInitialized()
- {
- int numTags = getNumTags();
- int tagMapSize = getOrCreateMap(3).size();
-
- // we are only initialized if the tag map is the equal in size
- // to the number of tags in the tld.
- return numTags == tagMapSize;
- }
-
- @Override
- public Map<String, ITagElement> getCurrentElements()
- {
- return getOrCreateMap(3);
- }
- }
-
- /**
- * Encapsulates all the data for a TLDNamespace. Allows the model
- * to be separated from the Namespace interface for ease of serialization and
- * controlled subclassing.
- *
- */
- public abstract static class TLDNamespaceData implements Serializable
- {
- /**
- *
- */
- private static final long serialVersionUID = -1284294636936289804L;
-
- /**
- * @return the displayb
- */
- public abstract String getDisplayName();
-
-// public abstract ITagElement getOrCreateTagElement(String name,
-// Map<String, ITagElement> tags);
-
- /**
- * @return the number of tags
- */
- public abstract int getNumTags();
-
- /**
- * @return the namespace uri
- */
- public abstract String getUri();
-
- /**
- * @param name
- * @return the view element for name or null if not found.
- */
- public abstract ITagElement getViewElement(final String name);
-
- /**
- * May be long running since it will lazily calculate all unloaded
- * tags.
- * @return all view elements for this namespace
- */
- public abstract Map<String, ITagElement> getAllViewElements();
-
- /**
- * @return true if all elements have been lazily loaded
- */
- public abstract boolean isInitialized();
-
- /**
- * @return just the currently loaded elements for this namespace.
- */
- public abstract Map<String, ITagElement> getCurrentElements();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java
deleted file mode 100644
index a63468551..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagElement.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttributeHandler;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.TagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
-
-
-/**
- * A tag element for a JSP tag (TLD-defined)
- *
- * @author cbateman
- *
- */
-public class TLDTagElement extends TagElement
-{
- /**
- *
- */
- private static final long serialVersionUID = -874272538404837105L;
- private final TLDElementData _tldData;
-
- /**
- * @param elementDecl
- * @param advisor
- */
- public TLDTagElement(final TLDElementDeclaration elementDecl
- , final IAttributeAdvisor advisor)
- {
- _tldData = new DocumentElementData(elementDecl, advisor);
- }
-
- @Override
- public String getName()
- {
- return _tldData.getName();
- }
-
- @Override
- public String getUri()
- {
- return _tldData.getUri();
- }
-
- @Override
- public String getTagHandlerClassName() {
- return _tldData.getTagHandlerClassName();
- }
-
- @Override
- public String toString()
- {
- return String.format("Tag: Tag Handler: name=%s, uri=%s, tagHandlerClassName=%s\n" //$NON-NLS-1$
- , getName(), getUri(), getTagHandlerClassName())
- + constructAttributesString();
- }
-
- /**
- * @return a string representation of the attributes.
- */
- protected String constructAttributesString()
- {
- String attributes = ""; //$NON-NLS-1$
-
- for (final Iterator it = getAttributeHandlers().entrySet().iterator(); it.hasNext();)
- {
- final Map.Entry entry = (Entry) it.next();
- final String name = (String) entry.getKey();
- final ITagAttributeHandler handler = (ITagAttributeHandler) entry.getValue();
-
- attributes += String.format("\t\t\tAttribute: name=%s, customHandler=%s, propertyName=%s, isELAllowed=%b\n", //$NON-NLS-1$
- name, handler.getCustomHandler(), handler.getName(),
- Boolean.valueOf(handler.isELAllowed()));
- }
- return attributes;
- }
-
- @Override
- public Map getAttributeHandlers()
- {
- return _tldData.getAttributes();
- }
-
- private static class DocumentElementData extends TLDElementData
- {
- /**
- * serialization id
- */
- private static final long serialVersionUID = -6160324802818766058L;
- private final TLDElementDeclaration _tldDoc;
- private final CMNodeNamedMapAdapter _adapter;
-
- public DocumentElementData(final TLDElementDeclaration tldDoc,
- final IAttributeAdvisor advisor)
- {
- _tldDoc = tldDoc;
- _adapter = new CMNodeNamedMapAdapter(tldDoc, advisor);
- }
-
- @Override
- public String getName()
- {
- return _tldDoc.getElementName();
- }
-
- @Override
- public String getTagHandlerClassName()
- {
- return _tldDoc.getTagclass();
- }
-
- @Override
- public String getUri()
- {
- final CMDocument owner = _tldDoc.getOwnerDocument();
-
- if (owner instanceof TLDDocument)
- {
- return ((TLDDocument)owner).getUri();
- }
- return null;
- }
-
- private Object writeReplace()
- {
- return new SerializedTLDElementData(getName(), getTagHandlerClassName(), getUri()
- , _adapter);
- }
-
- @SuppressWarnings("unused")
- private void readObject(java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException
- {
- throw new UnsupportedOperationException("This object should be serialized; writeReplace"); //$NON-NLS-1$
- }
-
- @Override
- public Map<String, ? extends ITagAttributeHandler> getAttributes()
- {
- return _adapter;
- }
- }
-
- /**
- * @author cbateman
- *
- */
- private static class SerializedTLDElementData extends TLDElementData
- {
- /**
- *
- */
- private static final long serialVersionUID = 4008084060638384114L;
- private final String _name;
- private final String _uri;
- private final String _tagHandlerClassName;
- private final Map<String, ? extends ITagAttributeHandler> _tagAttributes;
-
- /**
- * @param name
- * @param tagHandlerClassName
- * @param uri
- * @param tagAttributes
- */
- private SerializedTLDElementData(final String name,
- final String tagHandlerClassName, final String uri,
- final Map<String, ? extends ITagAttributeHandler> tagAttributes)
- {
- super();
- _name = name;
- _tagHandlerClassName = tagHandlerClassName;
- _uri = uri;
- // copy the map, because we don't if it is simply delta
- _tagAttributes = new HashMap(tagAttributes);
- }
-
- @Override
- public String getName()
- {
- return _name;
- }
-
- @Override
- public String getTagHandlerClassName()
- {
- return _tagHandlerClassName;
- }
-
- @Override
- public String getUri()
- {
- return _uri;
- }
-
- @Override
- public Map<String, ? extends ITagAttributeHandler> getAttributes()
- {
- return _tagAttributes;
- }
- }
-
- private static abstract class TLDElementData implements Serializable
- {
- /**
- *
- */
- private static final long serialVersionUID = -2494388738109839064L;
- public abstract String getTagHandlerClassName();
- public abstract String getName();
- public abstract String getUri();
- public abstract Map<String, ? extends ITagAttributeHandler> getAttributes();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java
deleted file mode 100644
index d637f49e2..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagHandlerElement.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * A TLD-defined tag (i.e. JSP) that maps to a known tag handler.
- *
- * @author cbateman
- *
- */
-public class TLDTagHandlerElement extends TLDJSFTagElement implements
-IHandlerTagElement
-{
- /**
- *
- */
- private static final long serialVersionUID = 8984277085824995102L;
- private final TagHandlerType _tagHandlerType;
-
- /**
- * @param elementDecl
- * @param tagHandlerType
- * @param advisor
- */
- public TLDTagHandlerElement(final TLDElementDeclaration elementDecl, final TagHandlerType tagHandlerType, final IAttributeAdvisor advisor)
- {
- super(elementDecl, advisor);
- _tagHandlerType = tagHandlerType;
- }
-
- public TagHandlerType getTagHandlerType()
- {
- return _tagHandlerType;
- }
-
- @Override
- public TagType getType()
- {
- return TagType.HANDLER;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java
deleted file mode 100644
index e99d97b07..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDValidatorTagElement.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IValidatorTagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * A TLD-defined tag (i.e. JSP) that maps one-to-one with a JSF Converter
- *
- * @author cbateman
- *
- */
-public class TLDValidatorTagElement extends TLDJSFTagElement implements IValidatorTagElement
-{
- /**
- *
- */
- private static final long serialVersionUID = 4251223772554969477L;
- private final ValidatorTypeInfo _validator;
-
- /**
- * @param elementDecl
- * @param validatorTypeInfo
- * @param advisor
- */
- public TLDValidatorTagElement(final TLDElementDeclaration elementDecl, final ValidatorTypeInfo validatorTypeInfo, final IAttributeAdvisor advisor)
- {
- super(elementDecl, advisor);
- _validator = validatorTypeInfo;
- }
-
- public final ValidatorTypeInfo getValidator()
- {
- return _validator;
- }
-
- @Override
- public final TagType getType()
- {
- return TagType.VALIDATOR;
- }
-
- @Override
- public String toString()
- {
- return _validator.toString();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java
deleted file mode 100644
index 6a5d97d35..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TagIntrospectingStrategy.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.designtime.internal.Messages;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer.TagAnalyzer;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * A resolving strategy that uses tag introspection.
- *
- * @author cbateman
- *
- */
-public final class TagIntrospectingStrategy extends JSPTagResolvingStrategy
-{
- /**
- * the identifier of this strategy
- */
- public final static String ID = "org.eclipse.jst.jsf.designtime.TagIntrospectingStrategy"; //$NON-NLS-1$
- /**
- * the display name
- */
- public final static String DISPLAY_NAME = Messages.TagIntrospectingStrategy_DisplayName;
-
- private final IProject _project;
-
- /**
- * @return the descriptor for this resolver strategy
- */
- public static StrategyDescriptor createDescriptor()
- {
- return new StrategyDescriptor(ID, DISPLAY_NAME);
- }
-
- /**
- * @param project
- */
- public TagIntrospectingStrategy(final IProject project)
- {
- // TODO: would it be better to have a model context on the resolve?
- _project = project;
- }
-
- @Override
- public String getId()
- {
- return ID;
- }
-
- public String getDisplayName()
- {
- return DISPLAY_NAME;
- }
-
- @Override
- public ITagElement resolve(TLDElementDeclaration element)
- {
- return TagAnalyzer.createTLDTagElement(element, _project);
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java
deleted file mode 100644
index 0a94f66b5..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/UnresolvedJSPTagResolvingStrategy.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * This a fallback strategy that always creates an element for a tld decl. This
- * can be tacked to the end of a composite strategy (or used alone) to ensure
- * that a basic ITagElement is always created for a TLDElementDeclaration.
- *
- * @author cbateman
- *
- */
-public class UnresolvedJSPTagResolvingStrategy extends JSPTagResolvingStrategy
-{
- /**
- * the identifier of this strategy
- */
- public final static String ID = "org.eclipse.jst.jsf.designtime.UnresolvedJSPTagResolvingStrategy"; //$NON-NLS-1$
- /**
- * the displayable name
- */
- public final static String DISPLAY_NAME = Messages.UnresolvedJSPTagResolvingStrategy_1;
-
- /**
- * @return the descriptor for this resolver strategy
- */
- public static StrategyDescriptor createDescriptor()
- {
- return new StrategyDescriptor(ID, DISPLAY_NAME);
- }
-
- @Override
- public String getId()
- {
- return ID;
- }
-
- public String getDisplayName()
- {
- return DISPLAY_NAME;
- }
-
- @Override
- public ITagElement resolve(TLDElementDeclaration element)
- {
- // just create a tag element
- return new TLDTagElement(element, new NullAttributeAdvisor());
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java
deleted file mode 100644
index 19951a9a8..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/ServletBeanProxyContributor.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.internal.proxy.core.ConfigurationContributorAdapter;
-import org.eclipse.jem.internal.proxy.core.IConfigurationContributionController;
-import org.eclipse.jst.jsf.core.JSFVersion;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-import org.osgi.framework.Bundle;
-
-class ServletBeanProxyContributor extends ConfigurationContributorAdapter
-{
- private final IProject _project;
- private final JSFVersion _jsfVersion;
-
- public ServletBeanProxyContributor(final IProject project)
- {
- _project = project;
- _jsfVersion = getProjectVersion(project);
- if (_jsfVersion == null)
- {
- throw new IllegalArgumentException("jsfVersion must not be null"); //$NON-NLS-1$
- }
-
- }
-
- @Override
- public void contributeClasspaths(
- final IConfigurationContributionController controller)
- throws CoreException
- {
- if (_jsfVersion != JSFVersion.V1_2)
- {
- final Bundle servletBundle = Platform.getBundle("javax.servlet"); //$NON-NLS-1$
- controller.contributeClasspath(servletBundle, (IPath) null,
- IConfigurationContributionController.APPEND_USER_CLASSPATH,
- true);
-
- final Bundle jspBundle = Platform.getBundle("javax.servlet.jsp"); //$NON-NLS-1$
- controller.contributeClasspath(jspBundle, (IPath) null,
- IConfigurationContributionController.APPEND_USER_CLASSPATH,
- true);
- }
- else
- {
- final Bundle coreBundle = JSFCorePlugin.getDefault().getBundle();
- final IJavaProject javaProject = JavaCore.create(_project);
- maybeAddJar(controller, "javax.servlet.jsp.tagext.JspIdConsumer", //$NON-NLS-1$
- javaProject, coreBundle, "/jars/fake_jsp_21.jar"); //$NON-NLS-1$
- maybeAddJar(controller, "javax.el.ELException", javaProject, //$NON-NLS-1$
- coreBundle, "/jars/fake_el.jar"); //$NON-NLS-1$
- }
- }
-
- private void maybeAddJar(
- final IConfigurationContributionController controller,
- final String addIfTypeNameNotFound, final IJavaProject javaProject,
- final Bundle bundle, final String path)
- {
- try
- {
- final IType type = javaProject.findType(addIfTypeNameNotFound);
- // if we can't find the type name on the classpath,then inject
- // our fake jar to aid linkage while introspecting facelet libs
- if (type == null)
- {
-
- controller
- .contributeClasspath(
- bundle,
- path,
- IConfigurationContributionController.APPEND_USER_CLASSPATH,
- false);
- }
- }
- catch (final JavaModelException jme)
- {
- // suppress
- }
- }
-
- static JSFVersion getProjectVersion(final IProject project)
- {
- try
- {
- if (FacetedProjectFramework.hasProjectFacet(project, "jst.jsf", //$NON-NLS-1$
- "1.0")) //$NON-NLS-1$
- {
- return JSFVersion.V1_0;
- }
- else if (FacetedProjectFramework.hasProjectFacet(project,
- "jst.jsf", "1.1")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- return JSFVersion.V1_1;
- }
- else if (FacetedProjectFramework.hasProjectFacet(project,
- "jst.jsf", "1.2")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- return JSFVersion.V1_2;
- }
- }
- catch (final CoreException e)
- {
- JSFCorePlugin.log("checking project version", e); //$NON-NLS-1$
- // fall-through
- }
-
- return null;
- }
-
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java
deleted file mode 100644
index ea1f16793..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/analyzer/TagAnalyzer.java
+++ /dev/null
@@ -1,862 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.analyzer;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaConventions;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jem.internal.proxy.core.IBeanProxy;
-import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy;
-import org.eclipse.jem.internal.proxy.core.IConfigurationContributor;
-import org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory;
-import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry;
-import org.eclipse.jem.internal.proxy.ide.IDERegistration;
-import org.eclipse.jst.jsf.common.runtime.internal.model.component.ComponentTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ConverterTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.model.decorator.ValidatorTypeInfo;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IHandlerTagElement.TagHandlerType;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.IJSFTagElement.TagType;
-import org.eclipse.jst.jsf.core.JSFVersion;
-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.designtime.internal.view.DTComponentIntrospector;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDComponentTagElement;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDConverterTagElement;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagElement;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagHandlerElement;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDValidatorTagElement;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.IAttributeAdvisor.NullAttributeAdvisor;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-
-/**
- * Utility class supporting methods to derive information from JSP tag
- * definitions (TLD)
- *
- * @author cbateman
- *
- */
-public final class TagAnalyzer
-{
- private static final String JAVAX_FACES_WEBAPP_CONVERTER_TAG = "javax.faces.webapp.ConverterTag"; //$NON-NLS-1$
- private static final String JAVAX_FACES_WEBAPP_CONVERTER_ELTAG = "javax.faces.webapp.ConverterELTag"; //$NON-NLS-1$
- private static final String JAVAX_FACES_WEBAPP_VALIDATOR_TAG = "javax.faces.webapp.ValidatorTag"; //$NON-NLS-1$
- private static final String JAVAX_FACES_WEBAPP_VALIDATOR_ELTAG = "javax.faces.webapp.ValidatorELTag"; //$NON-NLS-1$
- private static final String JAVAX_FACES_WEBAPP_FACET_TAG = "javax.faces.webapp.FacetTag"; //$NON-NLS-1$
-
- // private static final String JAVAX_FACES_WEBAPP_ACTIONLISTENER_TAG =
- // "javax.faces.webapp.ActionListenerTag";
- // private static final String JAVAX_FACES_WEBAPP_VALUECHANGELISTENER_TAG =
- // "javax.faces.webapp.ValueChangeListenerTag";
- private static final String JAVAX_FACES_WEBAPP_ATTRIBUTE_TAG = "javax.faces.webapp.AttributeTag"; //$NON-NLS-1$
-
- private final static Set<String> COMPONENT_TAG_HANDLER_TYPES_JSF11;
- private final static Set<String> COMPONENT_TAG_HANDLER_TYPES_JSF12;
-
- private final static Set<String> CONVERTER_TAG_HANDLER_TYPES_JSF11 = Collections
- .singleton(JAVAX_FACES_WEBAPP_CONVERTER_TAG);
- private final static Set<String> CONVERTER_TAG_HANDLER_TYPES_JSF12;
-
- private final static Set<String> VALIDATOR_TAG_HANDLER_TYPES_JSF11 = Collections
- .singleton(JAVAX_FACES_WEBAPP_VALIDATOR_TAG);
- private final static Set<String> VALIDATOR_TAG_HANDLER_TYPES_JSF12;
-
- private final static Set<String> FACET_TAG_HANDLER = Collections
- .singleton(JAVAX_FACES_WEBAPP_FACET_TAG);
- private final static Set<String> ATTRIBUTE_TAG_HANDLER = Collections
- .singleton(JAVAX_FACES_WEBAPP_ATTRIBUTE_TAG);
- // private final static Set<String> ACTIONLISTENER_TAG_HANDLER = Collections
- // .singleton(JAVAX_FACES_WEBAPP_ACTIONLISTENER_TAG);
- // private final static Set<String> VALUECHANGELISTENER_TAG_HANDLER =
- // Collections
- // .singleton(JAVAX_FACES_WEBAPP_VALUECHANGELISTENER_TAG);
-
- private final static Set<String> ALL_HANDLER_TAGS;
-
- static
- {
- // components
- // JSF 1.1
- Set<String> set = new HashSet<String>(8);
- set.add("javax.faces.webapp.UIComponentTag"); //$NON-NLS-1$
- set.add("javax.faces.webapp.UIComponentBodyTag"); //$NON-NLS-1$
- COMPONENT_TAG_HANDLER_TYPES_JSF11 = Collections.unmodifiableSet(set);
-
- // JSF 1.2
- set = new HashSet<String>(8);
- set.add("javax.faces.webapp.UIComponentTag"); //$NON-NLS-1$
- set.add("javax.faces.webapp.UIComponentBodyTag"); //$NON-NLS-1$
- set.add("javax.faces.webapp.UIComponentELTag"); //$NON-NLS-1$
- COMPONENT_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set);
-
- // converters
- set = new HashSet<String>(8);
- set.add(JAVAX_FACES_WEBAPP_CONVERTER_TAG);
- set.add(JAVAX_FACES_WEBAPP_CONVERTER_ELTAG);
- CONVERTER_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set);
-
- // validators
- set = new HashSet<String>(8);
- set.add(JAVAX_FACES_WEBAPP_VALIDATOR_TAG);
- set.add(JAVAX_FACES_WEBAPP_VALIDATOR_ELTAG);
- VALIDATOR_TAG_HANDLER_TYPES_JSF12 = Collections.unmodifiableSet(set);
-
- // tag handlers
- ALL_HANDLER_TAGS = new HashSet<String>();
- ALL_HANDLER_TAGS.addAll(FACET_TAG_HANDLER);
- ALL_HANDLER_TAGS.addAll(ATTRIBUTE_TAG_HANDLER);
- // ALL_HANDLER_TAGS.addAll(VALUECHANGELISTENER_TAG_HANDLER);
- // ALL_HANDLER_TAGS.addAll(ACTIONLISTENER_TAG_HANDLER);
- }
-
- /**
- * Tries to determine the component type of the component that corresponds
- * to the JSP tag defined by tldDecl.
- *
- * @param tldDecl
- * @param project
- * @return get the component type from the tag definition or null if none.
- */
- public static String findComponentType(final TLDElementDeclaration tldDecl,
- final IProject project)
- {
- final String className = tldDecl.getTagclass();
-
- final IConfigurationContributor[] contributor = new IConfigurationContributor[]
- { new ServletBeanProxyContributor(project) };
-
- ProxyFactoryRegistry registry = null;
- try
- {
- registry = getProxyFactoryRegistry(contributor, project);
-
- if (registry != null)
- {
-
- final IStandardBeanTypeProxyFactory factory = registry
- .getBeanTypeProxyFactory();
- final IBeanTypeProxy classTypeProxy = factory
- .getBeanTypeProxy(className);
- final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project,
- classTypeProxy);
-
- try
- {
- classTypeWrapper.init();
- return classTypeWrapper.callStringMethod("getComponentType"); //$NON-NLS-1$
- }
- catch (final ProxyException tp)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
- {
- JSFCoreTraceOptions.log("TagAnalyzer.findComponentType", tp); //$NON-NLS-1$
- }
- }
- }
- }
- finally
- {
- if (registry != null)
- {
- registry.terminateRegistry(true);
- }
- }
- return null;
- }
-
- /**
- * Tries to introspect tldDecl's tag class to determine what the identifier
- * of the underlying Converter that is used to register it in the app config
- *
- * @param tldDecl
- * @param project
- * @return the converter type identifier for the tldDecl or null if not
- * found
- */
- public static String findConverterType(final TLDElementDeclaration tldDecl,
- final IProject project)
- {
- // TODO: allow for pluggable resolver?
-
- // This one is more hacky and less prone to success than the component
- // type finder because the ConverterTag doesn't initialize its type
- // field on construction. Instead, both MyFaces and RI seem to do it
- // based on the doStartTag method. They also don't provide a standard
- // interface for acquiring the id so instead we make some guess on
- // the internal field name.
- ProxyFactoryRegistry registry = null;
- try
- {
- final String className = tldDecl.getTagclass();
-
- final IConfigurationContributor[] contributor = new IConfigurationContributor[]
- { new ServletBeanProxyContributor(project) };
- registry = getProxyFactoryRegistry(
- contributor, project);
-
- if (registry != null)
- {
- final IStandardBeanTypeProxyFactory factory = registry
- .getBeanTypeProxyFactory();
- final IBeanTypeProxy classTypeProxy = factory
- .getBeanTypeProxy(className);
-
- try
- {
- final IType type = JavaCore.create(project).findType(className);
-
- if (type != null
- && DTComponentIntrospector
- .isTypeNameInstanceOfClass(
- type,
- Collections
- .singleton(JAVAX_FACES_WEBAPP_CONVERTER_ELTAG)))
- {
- return findConverterType_InELTag(factory, classTypeProxy,project);
- }
- // the assumption is that this is a component tag, so we assume
- // it is one.
- else if (type != null
- && DTComponentIntrospector
- .isTypeNameInstanceOfClass(
- type,
- Collections
- .singleton(JAVAX_FACES_WEBAPP_CONVERTER_TAG)))
- {
- return findConverterType_InTag(factory, classTypeProxy, project);
- }
- }
- catch (final JavaModelException jme)
- {
- // suppress for now
- }
- }
- }
- finally
- {
- if (registry != null)
- {
- registry.terminateRegistry(true);
- }
- }
- return null;
- }
-
- private static String findConverterType_InTag(
- final IStandardBeanTypeProxyFactory factory,
- final IBeanTypeProxy classTypeProxy, final IProject project)
- {
- final IBeanTypeProxy nullPageContextType = factory
- .getBeanTypeProxy("javax.servlet.jsp.PageContext"); //$NON-NLS-1$
- final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project,
- classTypeProxy);
-
- try
- {
- classTypeWrapper.init();
-
- callSuppressExceptions(classTypeWrapper, "setPageContext", //$NON-NLS-1$
- new IBeanProxy[]
- { null }, new IBeanTypeProxy[]
- { nullPageContextType });
- callSuppressExceptions(classTypeWrapper, "doStartTag"); //$NON-NLS-1$
-
- final IBeanTypeProxy converterProxy = factory
- .getBeanTypeProxy(JAVAX_FACES_WEBAPP_CONVERTER_TAG);
-
- // hopefully doStartTag set the converter field before it
- // failed.
- // now try to guess what it's called
- String converterId = getStringField(classTypeWrapper,
- converterProxy, "converterId"); //$NON-NLS-1$
-
- if (converterId != null)
- {
- return converterId;
- }
-
- converterId = getStringField(classTypeWrapper, converterProxy,
- "_converterId"); //$NON-NLS-1$
-
- if (converterId != null)
- {
- return converterId;
- }
-
- // no? look for a CONVERTER_ID
- converterId = getStringField(classTypeWrapper, classTypeProxy,
- "CONVERTER_ID"); //$NON-NLS-1$
- }
- catch (final ProxyException tp)
- {
- // fall through
- }
- return null;
- }
-
- private static String findConverterType_InELTag(
- final IStandardBeanTypeProxyFactory factory,
- final IBeanTypeProxy classTypeProxy, final IProject project)
- {
- final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project,
- classTypeProxy);
- final IBeanTypeProxy elExpressionType = factory
- .getBeanTypeProxy("javax.el.ValueExpression"); //$NON-NLS-1$
-
- if (elExpressionType == null)
- {
- return null;
- }
-
- try
- {
- classTypeWrapper.init();
-
- callSuppressExceptions(classTypeWrapper, "doStartTag"); //$NON-NLS-1$
-
- // no? look for a CONVERTER_ID
- final IBeanProxy converterId = getFieldInParents(classTypeWrapper,
- classTypeProxy, "CONVERTER_ID_EXPR"); //$NON-NLS-1$
-
- if (converterId != null)
- {
- converterId.getTypeProxy().isKindOf(elExpressionType);
- final BeanProxyWrapper elExprValue = new BeanProxyWrapper(project,
- converterId.getTypeProxy());
- final String value = elExprValue
- .callStringMethod("getExpressionString"); //$NON-NLS-1$
- System.out.println("Expression string:" + value); //$NON-NLS-1$
- }
-
- //
- //
- // final IBeanTypeProxy converterProxy = factory
- // .getBeanTypeProxy(JAVAX_FACES_WEBAPP_CONVERTER_TAG);
-
- }
- catch (final ProxyException tp)
- {
- // fall through
- }
- return null;
- }
-
- /**
- * @param tldDecl
- * @param project
- * @return the validator type identifier for the tldDecl or null if not
- * found
- */
- public static String findValidatorType(final TLDElementDeclaration tldDecl,
- final IProject project)
- {
- // TODO: allow for pluggable resolver?
-
- // This one is more hacky and less prone to success than the component
- // type finder because the Validator doesn't initialize its type
- // field on construction. Instead, both MyFaces and RI seem to do it
- // based on the doStartTag method. They also don't provide a standard
- // interface for acquiring the id so instead we make some guess on
- // the internal field name.
- final String className = tldDecl.getTagclass();
-
- final IConfigurationContributor[] contributor = new IConfigurationContributor[]
- { new ServletBeanProxyContributor(project) };
-
- ProxyFactoryRegistry registry = null;
-
- try
- {
- registry = getProxyFactoryRegistry(contributor, project);
-
- if (registry != null)
- {
- final IStandardBeanTypeProxyFactory factory = registry
- .getBeanTypeProxyFactory();
- final IBeanTypeProxy classTypeProxy = factory
- .getBeanTypeProxy(className);
- final BeanProxyWrapper classTypeWrapper = new BeanProxyWrapper(project,
- classTypeProxy);
- final IBeanTypeProxy converterProxy = factory
- .getBeanTypeProxy(JAVAX_FACES_WEBAPP_VALIDATOR_TAG);
- try
- {
- classTypeWrapper.init();
-
- callSuppressExceptions(classTypeWrapper, "doStartTag"); //$NON-NLS-1$
- callSuppressExceptions(classTypeWrapper, "createValidator"); //$NON-NLS-1$
-
- // hopefully doStartTag set the converter field before it
- // failed.
- // now try to guess what it's called
- String validatorId = getStringField(classTypeWrapper,
- converterProxy, "validatorId"); //$NON-NLS-1$
-
- if (validatorId != null)
- {
- return validatorId;
- }
-
- validatorId = getStringField(classTypeWrapper, converterProxy,
- "_validatorId"); //$NON-NLS-1$
-
- if (validatorId != null)
- {
- return validatorId;
- }
-
- // no? then see if there's a VALIDATOR_ID field *on the tag*
- validatorId = getStringField(classTypeWrapper, classTypeProxy,
- "VALIDATOR_ID"); //$NON-NLS-1$
-
- if (validatorId != null)
- {
- return validatorId;
- }
- }
- catch (final ProxyException tp)
- {
- // fall through
- }
- }
- }
- finally
- {
- if (registry != null)
- {
- registry.terminateRegistry(true);
- }
- }
- return null;
-
- }
-
- private static IBeanProxy getFieldInParents(
- final BeanProxyWrapper classTypeWrapper,
- final IBeanTypeProxy typeProxy, final String fieldName)
- {
- try
- {
- return classTypeWrapper.getFieldValueIncludeParents(fieldName,
- typeProxy);
- }
- catch (final ProxyException e)
- {
- // suppress
- }
-
- return null;
- }
-
- private static String getStringField(
- final BeanProxyWrapper classTypeWrapper,
- final IBeanTypeProxy typeProxy, final String fieldName)
- {
- try
- {
- return classTypeWrapper.getStringFieldValue(fieldName, typeProxy);
- }
- catch (final ProxyException e)
- {
- // suppress
- }
-
- return null;
- }
-
- private static void callSuppressExceptions(
- final BeanProxyWrapper classTypeWrapper, final String methodName)
- {
- try
- {
- classTypeWrapper.call(methodName);
- }
- catch (final ProxyException tp)
- {
- // suppress this since it may well throw an exception
- // depending on what assumptions the tag class is making
- // that won't be true because we're not in a servlet
- }
- }
-
- private static void callSuppressExceptions(
- final BeanProxyWrapper classTypeWrapper, final String methodName,
- final IBeanProxy[] args, final IBeanTypeProxy[] argTypes)
- {
- try
- {
- classTypeWrapper.call(methodName, args, argTypes);
- }
- catch (final ProxyException tp)
- {
- // suppress this since it may well throw an exception
- // depending on what assumptions the tag class is making
- // that won't be true because we're not in a servlet
- }
-
- }
-
- /**
- * @param project
- * @return a new proxy factory registry or null;
- *
- * TODO: caching?
- */
- private static ProxyFactoryRegistry getProxyFactoryRegistry(
- final IConfigurationContributor[] configuration,
- final IProject project)
- {
- try
- {
- return IDERegistration.startAnImplementation(configuration, false,
- project, project.getName(), JSFCorePlugin.PLUGIN_ID,
- new NullProgressMonitor());
- }
- catch (final CoreException e)
- {
- JSFCorePlugin.log("Error starting vm for project: " //$NON-NLS-1$
- + project.getName(), e);
- }
-
- return null;
- }
-
- /**
- * @param tldDecl
- * @param project
- * @return the tag element for the tldDecl
- */
- public static TLDTagElement createTLDTagElement(
- final TLDElementDeclaration tldDecl, final IProject project)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
- {
- JSFCoreTraceOptions
- .log(String
- .format(
- "TagAnalyzer.createTLDTagElement: Start tld=%s, project=%s", //$NON-NLS-1$
- tldDecl.getNodeName(), project.getName()));
- }
- long startTime = 0;
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF)
- {
- startTime = System.nanoTime();
- }
-
- try
- {
- final IJavaProject javaProject = JavaCore.create(project);
- final String typeName = tldDecl.getTagclass();
-
- if (typeName == null
- || JavaConventions.validateJavaTypeName(typeName,
- JavaCore.VERSION_1_3,
- JavaCore.VERSION_1_3).getSeverity() == IStatus.ERROR)
- {
- JSFCorePlugin.log(
- "Bad tag class name in " + tldDecl.toString(), //$NON-NLS-1$
- new Throwable());
- return null;
- }
-
- final IType type = javaProject.findType(typeName);
-
- if (type == null)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
- {
- JSFCoreTraceOptions.log("Type not found for: "+typeName); //$NON-NLS-1$
- }
- return null;
- }
- final TagType tagType = getJSFComponentTagType(type, project);
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
- {
- JSFCoreTraceOptions.log(String.format(
- "Tag class type=%s\nTag type=%s", type, tagType)); //$NON-NLS-1$
- }
-
- if (tagType == TagType.COMPONENT)
- {
- final TLDTagElement element = createComponentTagElement(tldDecl, project);
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF)
- {
- String name = element != null ? element.toString()
- : "<none>"; //$NON-NLS-1$
- System.out.printf(
- "Time to create component tag element %s was %d\n", //$NON-NLS-1$
- name, Long.valueOf(System.nanoTime() - startTime));
- }
- return element;
- }
- else if (tagType == TagType.CONVERTER)
- {
- final TLDTagElement element = createConverterTagElement(tldDecl, project);
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF)
- {
- String name = element != null ? element.toString()
- : "<none>"; //$NON-NLS-1$
- System.out.printf(
- "Time to create converter tag element %s was %d\n", //$NON-NLS-1$
- name, Long.valueOf(System.nanoTime() - startTime));
- }
- return element;
- }
- else if (tagType == TagType.VALIDATOR)
- {
- final TLDTagElement element = createValidatorTagElement(tldDecl, project);
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF)
- {
- String name = element != null ? element.toString()
- : "<none>"; //$NON-NLS-1$
- System.out.printf(
- "Time to create validator tag element %s was %d\n", //$NON-NLS-1$
- name, Long.valueOf(System.nanoTime() - startTime));
- }
- return element;
- }
- else if (tagType == TagType.HANDLER)
- {
- final TLDTagElement element = createHandlerTagElement(tldDecl, type);
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR_PERF)
- {
- String name = element != null ? element.toString()
- : "<none>"; //$NON-NLS-1$
- System.out.printf(
- "Time to create handler tag element %s was %d\n", //$NON-NLS-1$
- name, Long.valueOf(System.nanoTime() - startTime));
- }
- return element;
- }
- }
- catch (final JavaModelException jme)
- {
- JSFCorePlugin.log(jme, "Trying to get type for TLD"); //$NON-NLS-1$
- }
-
- return null;
- }
-
- /**
- * @param tldDecl
- * @param project
- * @return a component tag element for tldDecl
- */
- public static TLDTagElement createComponentTagElement(
- final TLDElementDeclaration tldDecl, final IProject project)
- {
- final String componentType = findComponentType(tldDecl, project);
-
- if (componentType != null)
- {
- final String componentClass = DTComponentIntrospector
- .findComponentClass(componentType, project);
-
- if (componentClass != null && !"".equals(componentClass.trim())) //$NON-NLS-1$
- {
- final ComponentTypeInfo typeInfo = DTComponentIntrospector
- .getComponent(componentType, componentClass, project,
- new IConfigurationContributor[]
- {new ServletBeanProxyContributor(project)});
-
- if (typeInfo != null)
- {
- final TLDComponentTagElement tagElement = new TLDComponentTagElement(
- tldDecl, typeInfo, new NullAttributeAdvisor());
- return tagElement;
- }
- }
- }
-
- // TODO: really return null?
- return null;
- }
-
- /**
- * @param tldDecl
- * @param project
- * @return a converter tag element for tldDecl
- */
- public static TLDTagElement createConverterTagElement(
- final TLDElementDeclaration tldDecl, final IProject project)
- {
- final String converterId = findConverterType(tldDecl, project);
-
- if (converterId != null)
- {
- final String converterClass = DTComponentIntrospector
- .findConverterClass(converterId, project);
-
- if (converterClass != null && !"".equals(converterClass.trim())) //$NON-NLS-1$
- {
- final ConverterTypeInfo typeInfo = DTComponentIntrospector
- .getConverter(converterId, converterClass);
- final TLDConverterTagElement tagElement = new TLDConverterTagElement(
- tldDecl, typeInfo, new NullAttributeAdvisor());
- return tagElement;
- }
- }
-
- // we know (actually we assume by contract) that this a converter
- // so create an unknown converter tag for it
- return new TLDConverterTagElement(tldDecl, ConverterTypeInfo.UNKNOWN, new NullAttributeAdvisor());
- }
-
- /**
- * @param tldDecl
- * @param project
- * @return a validator tag element for the tldDec
- */
- public static TLDTagElement createValidatorTagElement(
- final TLDElementDeclaration tldDecl, final IProject project)
- {
- final String validatorId = findValidatorType(tldDecl, project);
-
- if (validatorId != null)
- {
- final String validatorClass = DTComponentIntrospector
- .findValidatorClass(validatorId, project);
-
- if (validatorClass != null && !"".equals(validatorClass.trim())) //$NON-NLS-1$
- {
- final ValidatorTypeInfo typeInfo = DTComponentIntrospector
- .getValidator(validatorId, validatorClass);
- final TLDValidatorTagElement tagElement = new TLDValidatorTagElement(
- tldDecl, typeInfo, new NullAttributeAdvisor());
- return tagElement;
- }
- }
- // we know (actually we assume by contract) that this a validator
- // so create an unknown converter tag for it
- return new TLDValidatorTagElement(tldDecl, ValidatorTypeInfo.UNKNOWN, new NullAttributeAdvisor());
- }
-
- /**
- * @param tldDecl
- * @param type
- * @return the tag element for a JSF handler
- */
- public static TLDTagElement createHandlerTagElement(
- final TLDElementDeclaration tldDecl, final IType type)
- {
- if (DTComponentIntrospector.isTypeNameInstanceOfClass(type,
- FACET_TAG_HANDLER))
- {
- return new TLDTagHandlerElement(tldDecl, TagHandlerType.FACET, new NullAttributeAdvisor());
- }
- else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type,
- ATTRIBUTE_TAG_HANDLER))
- {
- return new TLDTagHandlerElement(tldDecl, TagHandlerType.ATTRIBUTE, new NullAttributeAdvisor());
- }
- // else if (isTypeNameInstanceOfClass(type, ACTIONLISTENER_TAG_HANDLER))
- // {
- // return new TLDTagHandlerElement(tldDecl,
- // TagHandlerType.ACTIONLISTENER);
- // }
- // else if (isTypeNameInstanceOfClass(type,
- // VALUECHANGELISTENER_TAG_HANDLER))
- // {
- // return new TLDTagHandlerElement(tldDecl,
- // TagHandlerType.VALUECHANGELISTENER);
- // }
- return null;
- }
-
- /**
- * @param type
- * @param project
- * @return true if type represents a JSF component action class (spec 9.2.2)
- */
- public static IJSFTagElement.TagType getJSFComponentTagType(
- final IType type, final IProject project)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
- {
- JSFCoreTraceOptions
- .log(String
- .format(
- "TagAnalyzer.getJSFComponentTagType: Determining Tag Type for type %s on project %s", //$NON-NLS-1$
- type.getFullyQualifiedName(), project
- .toString()));
- }
-
- Set<String> componentTags = null;
- Set<String> converterTags = null;
- Set<String> validatorTags = null;
-
- final JSFVersion jsfVersion = ServletBeanProxyContributor.getProjectVersion(project);
-
- // v1.1(9.2.2): JSF component tags must sub-class one of these
- if (jsfVersion == JSFVersion.V1_0 || jsfVersion == JSFVersion.V1_1)
- {
- componentTags = COMPONENT_TAG_HANDLER_TYPES_JSF11;
- converterTags = CONVERTER_TAG_HANDLER_TYPES_JSF11;
- validatorTags = VALIDATOR_TAG_HANDLER_TYPES_JSF11;
- }
- // v1.2(9.2.2): JSF component tags must sub-class UIComponentELTag
- // the original two are included because we must be backward
- // compatible
- else if (jsfVersion == JSFVersion.V1_2)
- {
- componentTags = COMPONENT_TAG_HANDLER_TYPES_JSF12;
- converterTags = CONVERTER_TAG_HANDLER_TYPES_JSF12;
- validatorTags = VALIDATOR_TAG_HANDLER_TYPES_JSF12;
- }
-
- TagType tagType = null;
-
- if (DTComponentIntrospector.isTypeNameInstanceOfClass(type,
- componentTags))
- {
- tagType = TagType.COMPONENT;
- }
- else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type,
- converterTags))
- {
- tagType = TagType.CONVERTER;
- }
- else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type,
- validatorTags))
- {
- tagType = TagType.VALIDATOR;
- }
- else if (DTComponentIntrospector.isTypeNameInstanceOfClass(type,
- ALL_HANDLER_TAGS))
- {
- tagType = TagType.HANDLER;
- }
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGINTROSPECTOR)
- {
- JSFCoreTraceOptions.log(String.format(
- "TagAnalyzer.getJSFComponentTagType: tag type is %s", //$NON-NLS-1$
- tagType != null ? tagType.toString() : "null")); //$NON-NLS-1$
- }
- return tagType;
- }
-
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties
deleted file mode 100644
index 15bf8c5b3..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/messages.properties
+++ /dev/null
@@ -1 +0,0 @@
-UnresolvedJSPTagResolvingStrategy_1=Unresolved Tag Resolver
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java
deleted file mode 100644
index 3f2799de9..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/MasterIndex.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions;
-import org.osgi.framework.Version;
-
-/**
- * The definitive index of what projects are indexed for JSP tag registry
- * persistence.
- *
- * @author cbateman
- *
- */
-class MasterIndex implements Serializable
-{
- public final static SerializableVersion CURRENT_VERSION = new SerializableVersion(
- 1, 0, 0);
-
- /**
- *
- */
- private static final long serialVersionUID = -2725662604972649316L;
-
- private final transient String _repositoryPath;
- private final transient File _storageFile;
-
- private IndexHeader _header;
- private List<ProjectIndex> _projectIndices;
-
- public MasterIndex(final File storageFile, final String repositoryPath)
- {
- _storageFile = storageFile;
- _repositoryPath = repositoryPath;
- }
-
- public synchronized void create(final SerializableVersion version)
- throws IOException
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("MasterIndex.create, version=:" //$NON-NLS-1$
- + version.toString());
- }
-
- _header = new IndexHeader(version);
- _projectIndices = new ArrayList<ProjectIndex>();
-
- save(_storageFile);
- }
-
- public synchronized void save(final File file) throws IOException
- {
- FileOutputStream out = null;
-
- try
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("Trying to save master index file: " //$NON-NLS-1$
- + file.getAbsolutePath());
- }
-
- out = new FileOutputStream(file);
- final ObjectOutputStream objStream = new ObjectOutputStream(out);
- objStream.writeObject(this);
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions
- .log("Master index file written successfully: " //$NON-NLS-1$
- + file.getAbsolutePath());
- }
- }
- finally
- {
- if (out != null)
- {
- out.close();
- }
- }
- }
-
- public synchronized void load(final SerializableVersion expectedVersion)
- throws IOException, ClassNotFoundException
- {
- FileInputStream in = null;
-
- try
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("Trying to load master index file: " //$NON-NLS-1$
- + _storageFile.getAbsolutePath());
- }
-
- in = new FileInputStream(_storageFile);
- final ObjectInputStream objStream = new ObjectInputStream(in);
- MasterIndex index = (MasterIndex) objStream.readObject();
- _header = index._header;
- _projectIndices = index._projectIndices;
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions
- .log("Loaded master index file successfully:" //$NON-NLS-1$
- + _storageFile.getAbsolutePath());
- JSFCoreTraceOptions.log("Initial contents: "); //$NON-NLS-1$
- System.out.println(index.toString());
- }
- }
- finally
- {
- if (in != null)
- {
- in.close();
- }
- }
- }
-
- public synchronized String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append(String.format("Header: %s\n\n", _header.toString())); //$NON-NLS-1$
-
- for (final ProjectIndex projIndex : _projectIndices)
- {
- buffer.append(String.format("\t%s\n", projIndex.toString())); //$NON-NLS-1$
- }
-
- return buffer.toString();
- }
-
- public synchronized ProjectIndex getProjectIndex(final IProject project)
- {
- ProjectIndex index = findIndex(project);
-
- if (index != null)
- {
- return index;
- }
-
- // otherwise, create.
- index = new ProjectIndex(0, project.getName(), _repositoryPath);
- index.create();
- _projectIndices.add(index);
- try
- {
- save(_storageFile);
- }
- catch (IOException ioe)
- {
- JSFCorePlugin.log(ioe,
- "Failed to save master index. Project Index for " //$NON-NLS-1$
- + project.toString() + " may not be saved"); //$NON-NLS-1$
- }
- return index;
- }
-
- public synchronized void removeProjectIndex(final IProject project) throws IOException
- {
- final ProjectIndex index = findIndex(project);
- if (index != null)
- {
- _projectIndices.remove(index);
- if (!index.remove())
- {
- throw new IOException("Failed to remove index file"); //$NON-NLS-1$
- }
- }
- }
-
- private ProjectIndex findIndex(final IProject project)
- {
- // check if the project already exists
- for (final ProjectIndex index : _projectIndices)
- {
- if (index.getProjectName().equals(project.getName()))
- {
- return index;
- }
- }
- return null;
- }
-
- private void writeObject(final java.io.ObjectOutputStream out)
- throws IOException
- {
- out.writeObject(_header);
- out.writeObject(_projectIndices);
- }
-
- private void readObject(final java.io.ObjectInputStream in)
- throws IOException, ClassNotFoundException
- {
- _header = (IndexHeader) in.readObject();
- _projectIndices = (List<ProjectIndex>) in.readObject();
- }
-
- private class IndexHeader implements Serializable
- {
- /**
- * serializable
- */
- private static final long serialVersionUID = 40851054201507727L;
-
- private final SerializableVersion _version;
-// private long _lastModifiedStamp;
-
- public IndexHeader(final SerializableVersion version)
- {
- _version = version;
-// _lastModifiedStamp = 0;
- }
-
-// protected final Version getVersion()
-// {
-// return _version.getVersion();
-// }
-//
-// protected final synchronized long modified()
-// {
-// return _lastModifiedStamp++;
-// }
-//
-// protected final synchronized long getLastModifiedStamp()
-// {
-// return _lastModifiedStamp;
-// }
-
- public String toString()
- {
- return "Version: " + _version.toString(); //$NON-NLS-1$
- }
- }
-
- static class SerializableVersion implements Serializable
- {
- private Version _version;
- /**
- *
- */
- private static final long serialVersionUID = 5973410328814890568L;
-
- public SerializableVersion(final int major, final int minor,
- final int micro)
- {
- _version = new Version(major, minor, micro);
- }
-
- public SerializableVersion(final String versionString)
- {
- _version = new Version(versionString);
- }
-
- public Version getVersion()
- {
- return _version;
- }
-
- public String toString()
- {
- return _version.toString();
- }
-
- private void writeObject(ObjectOutputStream out) throws IOException
- {
- out.writeObject(_version.toString());
- }
-
- private void readObject(ObjectInputStream in) throws IOException,
- ClassNotFoundException
- {
- final String versionString = (String) in.readObject();
- _version = new Version(versionString);
- }
- }
-
- static class ProjectIndex implements Serializable
- {
- /**
- *
- */
- private static final long serialVersionUID = 2864798175910805380L;
-
- private final String _projectName;
- private final String _relativePath;
- private final long _lastModStampOnProject;
- private File _file;
-
- /**
- * @param lastModStampOnProject
- * @param projectName
- * @param relativePath
- */
- public ProjectIndex(final long lastModStampOnProject,
- final String projectName, final String relativePath)
- {
- super();
- _lastModStampOnProject = lastModStampOnProject;
- _projectName = projectName;
- _relativePath = relativePath;
- }
-
- public boolean remove()
- {
- return _file.delete();
- }
-
- public synchronized void create()
- {
- final long uniqueCode = Math
- .round((Math.random() * Integer.MAX_VALUE));
- final String fileName = String.format("Project_%s_%x.idx", //$NON-NLS-1$
- _projectName, Long.valueOf(uniqueCode));
- _file = new File(new Path(_relativePath).append(fileName)
- .toOSString());
- }
-
- public synchronized Map<String, SerializableTLDNamespace> getNamespaces()
- throws IOException, ClassNotFoundException
- {
- FileInputStream in = null;
-
- try
- {
- in = new FileInputStream(_file);
- final ObjectInputStream objStream = new ObjectInputStream(in);
- final Map<String, SerializableTLDNamespace> namespaces = (Map<String, SerializableTLDNamespace>) objStream
- .readObject();
- return namespaces;
- }
- catch (FileNotFoundException nfe)
- {
- return new HashMap<String, SerializableTLDNamespace>();
- }
- finally
- {
- if (in != null)
- {
- in.close();
- }
- }
- }
-
- public synchronized void save(
- final Map<String, SerializableTLDNamespace> namespaces)
- throws IOException
- {
- FileOutputStream out = null;
-
- try
- {
- out = new FileOutputStream(_file);
- final ObjectOutputStream objStream = new ObjectOutputStream(out);
- objStream.writeObject(namespaces);
- }
- finally
- {
- if (out != null)
- {
- out.close();
- }
- }
- }
-
- public String toString()
- {
- return "project= " + _projectName + ", relativePath=" //$NON-NLS-1$ //$NON-NLS-2$
- + _relativePath + ", lastModified=" //$NON-NLS-1$
- + _lastModStampOnProject + ", saveFile=" + _file; //$NON-NLS-1$
- }
-
- // public synchronized void save()
- // {
- // if (_file != null)
- // {
- // doSave();
- // }
- // throw new NullPointerException("_file is null");
- // }
- //
- // private void doSave() throws IOException
- // {
- // FileOutputStream out = null;
- //
- // try
- // {
- // out = new FileOutputStream(_file);
- // final ObjectOutputStream objStream = new ObjectOutputStream(out);
- // objStream.writeObject(this);
- // }
- // finally
- // {
- // if (out != null)
- // {
- // out.close();
- // }
- // }
- // }
-
- protected final String getProjectName()
- {
- return _projectName;
- }
-
- protected final String getRelativePath()
- {
- return _relativePath;
- }
-
- protected final long getLastModStampOnProject()
- {
- return _lastModStampOnProject;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java
deleted file mode 100644
index 6c95f0274..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/PersistedDataTagStrategy.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions;
-import org.eclipse.jst.jsf.designtime.internal.Messages;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.JSPTagResolvingStrategy;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDTagElement;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
-
-/**
- * @author cbateman
- *
- */
-public class PersistedDataTagStrategy extends JSPTagResolvingStrategy
-{
- /**
- * the identifier of this strategy
- */
- public final static String ID = "org.eclipse.jst.jsf.designtime.PersistedDataTagStrategy"; //$NON-NLS-1$
- /**
- * the display name
- */
- public final static String DISPLAY_NAME = Messages.PersistedDataTagStrategy_DisplayName;
-
- private final IProject _project;
- private final TagRepository _repository;
- private Map<String, SerializableTLDNamespace> _namespaces;
- private final transient AtomicBoolean _reentrancyFlag = new AtomicBoolean(
- false);
-
- /**
- * @return the descriptor for this resolver strategy
- */
- public static StrategyDescriptor createDescriptor()
- {
- return new StrategyDescriptor(ID, DISPLAY_NAME);
- }
-
- /**
- * @param project
- */
- public PersistedDataTagStrategy(final IProject project)
- {
- _project = project;
- _repository = new TagRepository(_project);
- }
-
- /**
- *
- */
- public void init()
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions
- .log("Initializing PersistedDataTagStrategy for project: " //$NON-NLS-1$
- + _project.toString());
- }
- try
- {
- _namespaces = _repository.load();
- return;
- }
- catch (final IOException e)
- {
- JSFCorePlugin
- .log(e,
- "JSP tag registry cached failed to load. Strategy will not be used"); //$NON-NLS-1$
- }
- catch (final ClassNotFoundException e)
- {
- JSFCorePlugin
- .log(e,
- "JSP tag registry cached failed to load. Strategy will not be used"); //$NON-NLS-1$
- }
- _namespaces = new HashMap<String, SerializableTLDNamespace>();
- }
-
- /**
- * @param namespace
- * @throws ClassNotFoundException
- * @throws IOException
- */
- public void save(final Map<String, TLDNamespace> namespace)
- throws IOException, ClassNotFoundException
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions
- .log("Saving PersistedDataTagStrategy for project: " //$NON-NLS-1$
- + _project.toString());
- }
-
- // namespace is considered authoritative for every key it contains
- // so copy them all in. However, preserve anything in our own namespace
- // map not found in namespace
- for (final Map.Entry<String, TLDNamespace> namespaceEntry : namespace
- .entrySet())
- {
- final TLDNamespace ns = namespaceEntry.getValue();
- final String nsName = namespaceEntry.getKey();
- final SerializableTLDNamespace myNs = _namespaces.get(nsName);
-
- if (myNs == null)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log(String.format(
- "Adding namespace %s for project", ns.getNSUri(), //$NON-NLS-1$
- _project.toString()));
- }
-
- _namespaces.put(nsName, new SerializableTLDNamespace(ns));
- }
- else
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log(String.format(
- "Updating namespace %s for project", ns.getNSUri(), //$NON-NLS-1$
- _project.toString()));
- }
-
- for (final Map.Entry<String, ITagElement> elementEntry : ns
- .getCurrentElements().entrySet())
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log(String.format(
- "Putting element %s", elementEntry.getKey())); //$NON-NLS-1$
- }
- myNs.put(elementEntry.getKey(), elementEntry.getValue());
- }
- }
- }
-
- _repository.save(_namespaces);
- }
-
- @Override
- public ITagElement resolve(final TLDElementDeclaration element)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log(String.format(
- "Attempting to resolve element %s for project %s", element //$NON-NLS-1$
- .getElementName(), _project));
- }
-
- try
- {
- if (!_reentrancyFlag.compareAndSet(false, true))
- {
- throw new IllegalStateException("Reentrant call to resolve"); //$NON-NLS-1$
- }
-
- final String uri = getUri(element);
- final String tagName = element.getElementName();
-
- if (uri != null && tagName != null)
- {
- final SerializableTLDNamespace ns = _namespaces.get(uri);
-
- if (ns != null)
- {
- final ITagElement tagElement = ns.getViewElement(tagName);
-
- if (tagElement instanceof TLDTagElement)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log(String.format(
- "Resolved element %s for project %s", //$NON-NLS-1$
- element.getElementName(), _project));
- }
- return tagElement;
- }
- }
- }
- return getNotFoundIndicator();
- }
- finally
- {
- _reentrancyFlag.set(false);
- }
- }
-
- /**
- * Clears all cached data and removes it permanently from disk.
- */
- public void clear()
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log(String.format(
- "Flushing all data for project %s", _project)); //$NON-NLS-1$
- }
-
- try
- {
- _repository.clearAll();
- }
- catch (IOException e)
- {
- JSFCorePlugin.log(e, "Failure during cache flushing on project: " //$NON-NLS-1$
- + _project);
- }
- catch (ClassNotFoundException e)
- {
- JSFCorePlugin.log(e, "Failure during cache flushing on project: " //$NON-NLS-1$
- + _project);
- }
- _namespaces.clear();
- }
-
- public String getDisplayName()
- {
- return DISPLAY_NAME;
- }
-
- private static String getUri(final TLDElementDeclaration element)
- {
- final CMDocument owner = element.getOwnerDocument();
-
- if (owner instanceof TLDDocument)
- {
- return ((TLDDocument) owner).getUri();
- }
- return null;
- }
-
- @Override
- public String getId()
- {
- return ID;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java
deleted file mode 100644
index b40878a8f..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/SerializableTLDNamespace.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace.TLDNamespaceData;
-
-/**
- * A serializable tld namespace. This is distinct from TLDNamespace in that it
- * takes a snapshot of a TLDNamespace at a point in time. Any elements not
- * lazily resolved by the TLDNamespace will not be resolved by this namespace.
- *
- */
-public class SerializableTLDNamespace extends Namespace
-{
- private final SerializedNamespaceData _data;
-
- /**
- * @param namespace
- */
- public SerializableTLDNamespace(final TLDNamespace namespace)
- {
- _data = new SerializedNamespaceData(namespace.getDisplayName(),
- namespace.getCurrentElements(), namespace.getNSUri());
- }
-
- /**
- *
- */
- private static final long serialVersionUID = 5364814479459691353L;
-
- @Override
- public String getDisplayName()
- {
- return _data.getDisplayName();
- }
-
- @Override
- public String getNSUri()
- {
- return _data.getUri();
- }
-
- @Override
- public ITagElement getViewElement(String name)
- {
- return _data.getViewElement(name);
- }
-
- @Override
- public Collection<? extends ITagElement> getViewElements()
- {
- return Collections.unmodifiableCollection(_data.getAllViewElements()
- .values());
- }
-
- @Override
- public boolean hasViewElements()
- {
- return _data.getNumTags() > 0;
- }
-
- @Override
- public boolean isInitialized()
- {
- return _data.isInitialized();
- }
-
- /* package */void put(final String name, final ITagElement tagElement)
- {
- _data._tags.put(name, tagElement);
- }
-
- private static class SerializedNamespaceData extends TLDNamespaceData
- {
- /**
- * serializable id
- */
- private static final long serialVersionUID = -6723194339788215607L;
- private final String _displayName;
- private final String _uri;
- private final Map<String, ITagElement> _tags;
-
- /**
- * @param displayName
- * @param tags
- * @param uri
- */
- private SerializedNamespaceData(String displayName,
- Map<String, ITagElement> tags, String uri)
- {
- super();
- _displayName = displayName;
- _tags = new HashMap<String, ITagElement>();
- for (final Map.Entry<String, ITagElement> tagEntry : tags.entrySet())
- {
- _tags.put(tagEntry.getKey(), tagEntry.getValue());
- }
- _uri = uri;
- }
-
- @Override
- public String getDisplayName()
- {
- return _displayName;
- }
-
- @Override
- public int getNumTags()
- {
- return _tags.size();
- }
-
- @Override
- public ITagElement getViewElement(String name)
- {
- return _tags.get(name);
- }
-
- @Override
- public String getUri()
- {
- return _uri;
- }
-
- @Override
- public Map<String, ITagElement> getAllViewElements()
- {
- return _tags;
- }
-
- @Override
- public boolean isInitialized()
- {
- return true;
- }
-
- @Override
- public Map<String, ITagElement> getCurrentElements()
- {
- return _tags;
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java
deleted file mode 100644
index 0d15744f8..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/persistence/TagRepository.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.MasterIndex.ProjectIndex;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.MasterIndex.SerializableVersion;
-
-class TagRepository
-{
- private final static Object GLOBAL_MASTER_INDEX_LOCK = new Object();
- private static MasterIndex GLOBAL_MASTER_INDEX;
- private final static String PATH_TO_REPOSITORY = "/.jsptagregistry"; //$NON-NLS-1$
- private final static String MASTER_INDEX_FILE_NAME = "tagRegistryMasterIndex.idx"; //$NON-NLS-1$
-
- private final IProject _project;
- //private Map<String, SerializableTLDNamespace> _namespaces;
-
- public TagRepository(final IProject project)
- {
- _project = project;
- }
-
- public Map<String, SerializableTLDNamespace> load() throws IOException,
- ClassNotFoundException
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("Loading tag repository for: " //$NON-NLS-1$
- + _project.toString());
- }
-
- final MasterIndex index = getOrCreateMasterIndex();
-
- final ProjectIndex projIndex = index.getProjectIndex(_project);
- final Map<String, SerializableTLDNamespace> namespaces = projIndex.getNamespaces();
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("Contents of repo for: " //$NON-NLS-1$
- + _project.toString());
-
- for (final Map.Entry<String, SerializableTLDNamespace> nsEntry : namespaces.entrySet())
- {
- JSFCoreTraceOptions.log("\tNamespace: "+nsEntry.getKey()); //$NON-NLS-1$
-
- SerializableTLDNamespace ns = nsEntry.getValue();
- for (final ITagElement element : ns.getViewElements())
- {
- JSFCoreTraceOptions.log("\t\tTag: "+element.toString()); //$NON-NLS-1$
- }
- }
- }
-
- return namespaces;
- }
-
- public void save(Map<String, SerializableTLDNamespace> namespaces) throws IOException,
- ClassNotFoundException
- {
- final MasterIndex index = getOrCreateMasterIndex();
- final ProjectIndex projectIndex = index.getProjectIndex(_project);
- projectIndex.save(namespaces);
- }
-
- public void clearAll() throws IOException, ClassNotFoundException
- {
- final MasterIndex index = getOrCreateMasterIndex();
- index.removeProjectIndex(_project);
- }
-
- private MasterIndex getOrCreateMasterIndex() throws IOException,
- ClassNotFoundException
- {
- final IPath wkspacePath = JSFCorePlugin.getDefault().getStateLocation();
- final IPath repoPath = wkspacePath.append(PATH_TO_REPOSITORY);
- final File repoDir = new File(repoPath.toOSString());
-
- synchronized (GLOBAL_MASTER_INDEX_LOCK)
- {
- if (GLOBAL_MASTER_INDEX != null)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions
- .log("GLOBAL_MASTER_INDEX already exists for: " //$NON-NLS-1$
- + _project.toString());
- }
- return GLOBAL_MASTER_INDEX;
- }
-
- if (!repoDir.exists())
- {
- createNewRepo(repoDir);
- }
-
- final File masterIndexFile = new File(new Path(repoDir
- .getAbsolutePath()).append(MASTER_INDEX_FILE_NAME)
- .toOSString());
- final MasterIndex index = new MasterIndex(masterIndexFile, repoDir.getAbsolutePath());
-
- if (!masterIndexFile.exists())
- {
- if (!masterIndexFile.createNewFile())
- {
- throw new IOException(
- "Could not create new master index file: " //$NON-NLS-1$
- + masterIndexFile.toString());
- }
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("Creating master index file for " //$NON-NLS-1$
- + _project.toString());
- }
- index.create(new SerializableVersion(1, 0, 0));
- }
- else
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("Loading master index file for " //$NON-NLS-1$
- + _project.toString());
- }
- index.load(new SerializableVersion(1, 0, 0));
- }
-
- GLOBAL_MASTER_INDEX = index;
- return index;
- }
- }
-
- private static void createNewRepo(final File repoDir) throws IOException
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGPERSISTENCE)
- {
- JSFCoreTraceOptions.log("Creating repo directory: " //$NON-NLS-1$
- + repoDir.getAbsolutePath());
- }
-
- if (!repoDir.mkdir())
- {
- throw new IOException("Failed to create repo directory: " //$NON-NLS-1$
- + repoDir.getAbsolutePath());
- }
- }
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java
deleted file mode 100644
index 403fea914..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsp.core.taglib.ITaglibRecord;
-
-abstract class LibraryOperation implements Runnable
-{
- protected final ITaglibRecord _changeRecord;
- private IStatus _result;
-
- protected LibraryOperation(final ITaglibRecord changeRecord)
- {
- _changeRecord = changeRecord;
- }
-
- public final void run()
- {
- try
- {
- _result = doRun();
- }
- catch (final Exception e)
- {
- _result = new Status(IStatus.ERROR, JSFCorePlugin.PLUGIN_ID,
- "Problem during run", e); //$NON-NLS-1$
- }
- }
-
- public IStatus getResult()
- {
- return _result;
- }
-
- protected abstract IStatus doRun();
-} \ No newline at end of file
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java
deleted file mode 100644
index 70f5d3f51..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/LibraryOperationFactory.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.jsp.core.taglib.ITaglibRecord;
-
-class LibraryOperationFactory
-{
- private final TLDTagRegistry _tagRegistry;
-
- public LibraryOperationFactory(final TLDTagRegistry tagRegistry)
- {
- _tagRegistry = tagRegistry;
- }
-
- LibraryOperation createAddOperation(final ITaglibRecord changeRecord)
- {
- return new AddTagLibrary(_tagRegistry, changeRecord);
- }
-
- LibraryOperation createRemoveOperation(final ITaglibRecord changeRecord)
- {
- return new RemoveTagLibrary(_tagRegistry, changeRecord);
- }
-
- LibraryOperation createChangeOperation(final ITaglibRecord changeRecord)
- {
- if (changeRecord == null)
- {
- throw new IllegalArgumentException();
- }
- return new ChangeTagLibrary(_tagRegistry, changeRecord);
- }
-
- private static class AddTagLibrary extends LibraryOperation
- {
- private final TLDTagRegistry _tagRegistry;
-
- public AddTagLibrary(final TLDTagRegistry tagRegistry,
- final ITaglibRecord newRecord)
- {
- super(newRecord);
- _tagRegistry = tagRegistry;
- }
-
- @Override
- protected IStatus doRun()
- {
- synchronized (_tagRegistry)
- {
- // fire change event if applicable
- _tagRegistry.initialize(_changeRecord, true);
- return Status.OK_STATUS;
- }
- }
- }
-
- private static class RemoveTagLibrary extends LibraryOperation
- {
- private final TLDTagRegistry _tagRegistry;
-
- protected RemoveTagLibrary(final TLDTagRegistry tagRegistry,
- final ITaglibRecord changeRecord)
- {
- super(changeRecord);
- _tagRegistry = tagRegistry;
- }
-
- @Override
- protected IStatus doRun()
- {
- _tagRegistry.remove(_changeRecord);
- return Status.OK_STATUS;
-
- }
-
- }
-
- private static class ChangeTagLibrary extends LibraryOperation
- {
- private final TLDTagRegistry _tagRegistry;
-
- protected ChangeTagLibrary(final TLDTagRegistry tagRegistry,
- final ITaglibRecord changeRecord)
- {
- super(changeRecord);
- _tagRegistry = tagRegistry;
- }
-
- @Override
- protected IStatus doRun()
- {
- IStatus result = null;
-
- synchronized (_tagRegistry)
- {
- result = new RemoveTagLibrary(_tagRegistry, _changeRecord).doRun();
-
- if (result.getSeverity() != IStatus.ERROR
- && result.getSeverity() != IStatus.CANCEL)
- {
- result = new AddTagLibrary(_tagRegistry, _changeRecord)
- .doRun();
- }
- }
-
- return result;
- }
-
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java
deleted file mode 100644
index e247b3725..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryManager.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry;
-
-import java.util.Collection;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ISaveContext;
-import org.eclipse.core.resources.ISaveParticipant;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.jsf.common.internal.resource.ResourceSingletonObjectManager;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions;
-import org.eclipse.jst.jsf.designtime.internal.Messages;
-import org.eclipse.jst.jsf.designtime.internal.view.model.ITagRegistry;
-import org.eclipse.jst.jsf.designtime.internal.view.model.TagRegistryFactory;
-
-/**
- * A per-resource singleton manager for TLDTagRegistry's.
- *
- * @author cbateman
- *
- */
-public final class TLDRegistryManager extends
- ResourceSingletonObjectManager<TLDTagRegistry, IProject>
-{
- // STATIC
- private static TLDRegistryManager INSTANCE;
-
- /**
- * @return the singleton instance
- */
- private static TLDRegistryManager getGlobalManager()
- {
- synchronized (TLDRegistryManager.class)
- {
- if (INSTANCE == null)
- {
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions
- .log("TLDRegistryManager: Initializing TLDRegistryManager singleton"); //$NON-NLS-1$
- }
- INSTANCE = new TLDRegistryManager();
- }
-
- return INSTANCE;
- }
- }
-
- private TLDRegistryManager()
- {
- final ISaveParticipant participant = new MyWorkspaceSaveParticipant();
-
- try
- {
- ResourcesPlugin.getWorkspace().addSaveParticipant(JSFCorePlugin.getDefault().getPluginID()
- , participant);
- }
- catch (CoreException e)
- {
- JSFCorePlugin.log(e, "TLDRegistryManager failed to install save participant"); //$NON-NLS-1$
- }
- }
-
- @Override
- protected TLDTagRegistry createNewInstance(final IProject project)
- {
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions
- .log("TLDRegistryManager: creating new instance for " //$NON-NLS-1$
- + project.toString());
- }
-
- return new TLDTagRegistry(project);
- }
-
- @Override
- protected void runAfterGetInstance(final IProject resource)
- {
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions
- .log("TLDRegistryManager: Acquired instance for " //$NON-NLS-1$
- + resource.toString());
- }
- }
-
- @Override
- protected void runBeforeGetInstance(final IProject resource)
- {
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions.log("TLDRegistryManager: Getting registry for " //$NON-NLS-1$
- + resource.toString());
- }
- }
-
- /**
- * Adapter used to allow creation by extension point.
- *
- * @author cbateman
- *
- */
- public static class MyRegistryFactory extends TagRegistryFactory
- {
- @Override
- public ITagRegistry createTagRegistry(IProject project)
- throws TagRegistryFactoryException
- {
- try
- {
- return getGlobalManager().getInstance(project);
- }
- catch (ManagedObjectException e)
- {
- throw new TagRegistryFactoryException(e);
- }
- }
-
- @Override
- public boolean isInstance(IProject project)
- {
- return getGlobalManager().isInstance(project);
- }
-
- public String getDisplayName()
- {
- return Messages.TLDRegistryManager_DisplayName;
- }
- }
-
- private class MyWorkspaceSaveParticipant implements ISaveParticipant
- {
- public void saving(ISaveContext context) throws CoreException
- {
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saving: Kind="+context.getKind()); //$NON-NLS-1$
- }
- try
- {
- if (context.getKind() == ISaveContext.FULL_SAVE)
- {
- final Collection<IProject> projects = TLDRegistryManager.this
- .getManagedResources();
-
- for (final IProject project : projects)
- {
- saveProject(project);
- }
- }
- else if (context.getKind() == ISaveContext.PROJECT_SAVE)
- {
- saveProject(context.getProject());
- }
-
- }
- catch (ManagedObjectException moe)
- {
- throw new CoreException(new Status(IStatus.ERROR,
- JSFCorePlugin.PLUGIN_ID, "Couldn't commit workspace", //$NON-NLS-1$
- moe));
- }
- }
-
- private void saveProject(final IProject project)
- throws ManagedObjectException
- {
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saveProject: Project="+project.toString()); //$NON-NLS-1$
- }
-
- // check that there is already instance -- don't do anything if there
- // isn't already an instance for project.
- if (TLDRegistryManager.this.isInstance(project))
- {
- final TLDTagRegistry registry = TLDRegistryManager.this
- .getInstance(project);
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions.log("MyWorkspaceSaveParticipant.saveProject: calling checkpoint on registry: "+registry.toString()); //$NON-NLS-1$
- }
-
- registry.checkpoint();
- }
- }
-
- public void doneSaving(ISaveContext context)
- {
- // nothing to do
- }
-
- public void prepareToSave(ISaveContext context) throws CoreException
- {
- // nothing to do
- }
-
- public void rollback(ISaveContext context)
- {
- // nothing to do
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java
deleted file mode 100644
index 593597ea7..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDRegistryPreferences.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider;
-import org.eclipse.jst.jsf.common.internal.policy.OrderedListProvider.OrderableObject;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.DefaultJSPTagResolver;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TagIntrospectingStrategy;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.JSPTagResolvingStrategy.StrategyDescriptor;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.PersistedDataTagStrategy;
-
-/**
- * Preferences model for the TLD registry. This class is not thread-safe and
- * a single instance should only be used by one owner.
- *
- * @author cbateman
- *
- */
-public class TLDRegistryPreferences
-{
- private final static Map<String, StrategyDescriptor> ALL_KNOWN_STRATEGIES;
-
- private final IPreferenceStore _prefStore;
- private final CopyOnWriteArrayList<PropertyListener> _listeners;
- private final AtomicBoolean _isDisposed = new AtomicBoolean(false);
-
- private final static String KEY_STRATEGY_ID_ORDER = "org.eclipse.jst.jsf.designtime.jsp.registry.StrategyIDOrder"; //$NON-NLS-1$
-
- private final static List<OrderableObject> DEFAULT_STRATEGY_ORDER;
-
- static
- {
- final List<OrderableObject> list = new ArrayList<OrderableObject>();
-
- // NOTE !!! this ordering is important and effects the default order
- // in which strategies will be consulted !!!
- list.add(new OrderableObject(new StrategyIdentifier(PersistedDataTagStrategy.createDescriptor()), true));
- list.add(new OrderableObject(new StrategyIdentifier(DefaultJSPTagResolver.createDescriptor()), true));
- list.add(new OrderableObject(new StrategyIdentifier(TagIntrospectingStrategy.createDescriptor()), true));
- DEFAULT_STRATEGY_ORDER = Collections.unmodifiableList(list);
-
-
- final Map<String, StrategyDescriptor> knownDescriptors = new HashMap<String, StrategyDescriptor>();
- for (final OrderableObject object : DEFAULT_STRATEGY_ORDER)
- {
- StrategyIdentifier strategyId = (StrategyIdentifier) object.getObject();
- knownDescriptors.put(strategyId.getId(), strategyId._descriptor);
- }
- ALL_KNOWN_STRATEGIES = Collections.unmodifiableMap(knownDescriptors);
- }
-
- private List<OrderableObject> _ids;
- private List<OrderableObject> _originalIds;
- private IPropertyChangeListener _propertyListener;
-
- /**
- * Constructor
- *
- * @param prefStore
- */
- public TLDRegistryPreferences(final IPreferenceStore prefStore)
- {
- _prefStore = prefStore;
- _ids = new ArrayList<OrderableObject>();
- _listeners = new CopyOnWriteArrayList<PropertyListener>();
- }
-
- /**
- * Dispose of this preferences object
- */
- public void dispose()
- {
- if (_isDisposed.compareAndSet(false, true))
- {
- if (_propertyListener != null)
- {
- _prefStore.removePropertyChangeListener(_propertyListener);
- }
- }
- }
-
- void addListener(final PropertyListener propListener)
- {
- if (!assertNotDisposed())
- {
- return;
- }
-
- if (_propertyListener == null)
- {
- _propertyListener = new IPropertyChangeListener()
- {
- public void propertyChange(PropertyChangeEvent event)
- {
- if (KEY_STRATEGY_ID_ORDER.equals(event.getProperty()))
- {
- fireStrategyOrderChanged();
- }
- }
- };
-
- _prefStore.addPropertyChangeListener(_propertyListener);
- }
- _listeners.addIfAbsent(propListener);
- }
-
- void removeListener(final PropertyListener propListener)
- {
- if (!assertNotDisposed())
- {
- return;
- }
- _listeners.remove(propListener);
-
- if (_listeners.isEmpty())
- {
- _prefStore.removePropertyChangeListener(_propertyListener);
- _propertyListener = null;
- }
- }
-
- private void fireStrategyOrderChanged()
- {
- if (!assertNotDisposed())
- {
- return;
- }
- for (final PropertyListener listener : _listeners)
- {
- listener.strategyOrderChanged();
- }
- }
-
- /**
- * @return false if the assertion fails
- */
- private boolean assertNotDisposed()
- {
- if (_isDisposed.get())
- {
- JSFCorePlugin.log(new Exception("Stack trace only"), "TLDRegistryPreferences is disposed"); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- return true;
- }
-
- /**
- * IPreferenceStore The default preference loader
- */
- public void load()
- {
- load(_prefStore);
- }
-
- /**
- * @return the ordered list provider for the strategy id ordering
- */
- public OrderedListProvider getOrderedListProvider()
- {
- return new MyOrderedListProvider();
- }
-
- /**
- * @return the strategy id ordering
- */
- public List<OrderableObject> getStrategyIdOrdering()
- {
- return _ids;
- }
-
- /**
- * @param ids
- */
- public void setStrategyIdOrdering(final List<OrderableObject> ids)
- {
- _ids = ids;
- }
-
- /**
- * @return the list of strategy ids in the order they should be consulted
- */
- public List<String> getEnabledIds()
- {
- final List<String> strategies = new ArrayList<String>();
-
- for (final OrderableObject id : _ids)
- {
- if (id.isEnabled())
- {
- StrategyIdentifier strategyId = (StrategyIdentifier) id.getObject();
- strategies.add(strategyId.getId());
- }
- }
- return strategies;
- }
-
- /**
- * Loads preferences from prefStore
- *
- * @param prefStore
- */
- private void load(final IPreferenceStore prefStore)
- {
- if (!prefStore.contains(KEY_STRATEGY_ID_ORDER))
- {
- prefStore.setDefault(KEY_STRATEGY_ID_ORDER,
- serialize(DEFAULT_STRATEGY_ORDER));
- }
- List<OrderableObject> ids = deserialize(prefStore
- .getString(KEY_STRATEGY_ID_ORDER));
- if (ids == null)
- {
- ids = deserialize(serialize(DEFAULT_STRATEGY_ORDER));
- }
- _ids = ids;
- final List<OrderableObject> originalList = new ArrayList<OrderableObject>();
- for (final OrderableObject id : _ids)
- {
- final OrderableObject copy = id.clone();
- originalList.add(copy);
- }
- _originalIds = Collections.unmodifiableList(originalList);
- }
-
- private String serialize(final List<OrderableObject> ids)
- {
- final StringBuffer buffer = new StringBuffer();
-
- for (final OrderableObject id : ids)
- {
- StrategyIdentifier strategyId = (StrategyIdentifier) id.getObject();
- buffer.append("dummyValue"); //$NON-NLS-1$
- buffer.append(","); //$NON-NLS-1$
- buffer.append(strategyId.getId());
- buffer.append(","); //$NON-NLS-1$
- buffer.append(id.isEnabled());
- buffer.append(","); //$NON-NLS-1$
- }
- return buffer.toString();
- }
-
- private List<OrderableObject> deserialize(final String serializedList)
- {
- final List<OrderableObject> list = new ArrayList<OrderableObject>();
- final String[] ids = serializedList.split(","); //$NON-NLS-1$
- if ((ids.length % 3) != 0)
- {
- return null;
- }
-
- for (int i = 0; i < ids.length; i += 3)
- {
- /// ingore the dummy value: final String displayName = ids[i];
- String id = ids[i + 1];
- final String enabled = ids[i + 2];
-
- // fix old id for meta-data resolver
- if ("org.eclipse.jst.jsf.THISISTEMPORARY".equals(id)) //$NON-NLS-1$
- {
- id = DefaultJSPTagResolver.ID;
- }
-
- final StrategyDescriptor desc = ALL_KNOWN_STRATEGIES.get(id);
-
- if (desc == null)
- {
- JSFCorePlugin.log(new Exception("Stack trace only"), "Error: unknown strategy id: "+id); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else
- {
- final StrategyIdentifier strategyIdentifier = new StrategyIdentifier(desc);
- list.add(new OrderableObject(strategyIdentifier
- , Boolean.valueOf(enabled).booleanValue()));
- }
- }
- return list;
- }
-
- /**
- * Commits but does not store the preferences
- *
- * @param prefStore
- */
- public void commit(final IPreferenceStore prefStore)
- {
- prefStore.setValue(KEY_STRATEGY_ID_ORDER,
- serialize(getStrategyIdOrdering()));
- // refresh local copy of preferences
- load();
- }
-
- /**
- * Reverts the model to it's defaults. Does not commit to pref store.
- */
- public void setDefaults()
- {
- setStrategyIdOrdering(new ArrayList<OrderableObject>(
- DEFAULT_STRATEGY_ORDER));
- }
-
- /**
- * @return true if this preference object's properties have
- * changed since load() was last called.
- */
- public boolean isDirty()
- {
- // dirty if the current list is not equal to the original list
- // generated at load time.
- return !(_ids.equals(_originalIds));
- }
-
- /**
- * Used as the model for sorting and enabling strategy identifiers.
- *
- */
- public static class StrategyIdentifier
- {
- private final StrategyDescriptor _descriptor;
-
- StrategyIdentifier(final StrategyDescriptor descriptor)
- {
- _descriptor = descriptor;
- }
-
- /**
- * @return the id
- */
- public String getId()
- {
- return _descriptor.getId();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof StrategyIdentifier)
- {
- return getId().equals(((StrategyIdentifier)obj).getId());
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getId().hashCode();
- }
-
- /**
- * @return the display name of the strategy
- */
- public String getDisplayName()
- {
- return _descriptor.getDisplayName();
- }
- }
-
- private class MyOrderedListProvider extends OrderedListProvider
- {
- @Override
- protected List<OrderableObject> createAndPopulateOrderedObjects()
- {
- return _ids;
- }
- }
-
- static abstract class PropertyListener
- {
- public abstract void strategyOrderChanged();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java
deleted file mode 100644
index b2248085d..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TLDTagRegistry.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jst.jsf.common.internal.managedobject.IManagedObject;
-import org.eclipse.jst.jsf.common.internal.policy.IdentifierOrderedIteratorPolicy;
-import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.Namespace;
-import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
-import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions;
-import org.eclipse.jst.jsf.designtime.internal.Messages;
-import org.eclipse.jst.jsf.designtime.internal.view.model.AbstractTagRegistry;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.CompositeTagResolvingStrategy;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.DefaultJSPTagResolver;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TLDNamespace;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.TagIntrospectingStrategy;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.UnresolvedJSPTagResolvingStrategy;
-import org.eclipse.jst.jsf.designtime.internal.view.model.jsp.persistence.PersistedDataTagStrategy;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.CMDocumentFactoryTLD;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDDocument;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDElementDeclaration;
-import org.eclipse.jst.jsp.core.taglib.ITLDRecord;
-import org.eclipse.jst.jsp.core.taglib.ITaglibRecord;
-import org.eclipse.jst.jsp.core.taglib.TaglibIndex;
-
-/**
- * Registry of all tld-defined tags for a particular project classpath
- *
- * @author cbateman
- *
- */
-public final class TLDTagRegistry extends AbstractTagRegistry implements
- IManagedObject
-{
- // INSTANCE
- private final IProject _project;
- private final Map<String, TLDNamespace> _nsResolved;
- private final CompositeTagResolvingStrategy<TLDElementDeclaration> _resolver;
- private boolean _hasBeenInitialized = false;
- private final ConcurrentLinkedQueue<LibraryOperation> _changeOperations = new ConcurrentLinkedQueue<LibraryOperation>();
- private final Job _changeJob;
- private final PersistedDataTagStrategy _persistedTagStrategy;
- private TagIndexListener _tagIndexListener;
- private final TLDRegistryPreferences _prefs;
- private final MyPropertyListener _myPropertyListener;
-
- TLDTagRegistry(final IProject project)
- {
- _project = project;
- _nsResolved = new HashMap<String, TLDNamespace>();
-
- _prefs = new TLDRegistryPreferences(JSFCorePlugin.getDefault().getPreferenceStore());
- _myPropertyListener = new MyPropertyListener();
- _prefs.addListener(_myPropertyListener);
- _prefs.load();
- final IdentifierOrderedIteratorPolicy<String> policy =
- getTagResolvingPolicy();
-
- _resolver = new CompositeTagResolvingStrategy<TLDElementDeclaration>(
- policy);
-
- // add the strategies
- _resolver.addStrategy(new TagIntrospectingStrategy(_project));
- _resolver.addStrategy(new DefaultJSPTagResolver(_project));
- // makes sure that a tag element will always be created for any
- // given tag definition even if other methods fail
- _resolver.addStrategy(new UnresolvedJSPTagResolvingStrategy());
- _persistedTagStrategy = new PersistedDataTagStrategy(_project);
- _persistedTagStrategy.init();
- _resolver.addStrategy(_persistedTagStrategy);
-
- _changeJob = new ChangeJob(project.getName());
- }
-
- private IdentifierOrderedIteratorPolicy<String> getTagResolvingPolicy()
- {
- // strategy ordering
- final List<String> prefOrdering = _prefs.getEnabledIds();
- final List<String> strategyOrdering = new ArrayList<String>(prefOrdering);
-
- // this strategy must always be here, always last
- strategyOrdering.add(UnresolvedJSPTagResolvingStrategy.ID);
-
- final IdentifierOrderedIteratorPolicy<String> policy = new IdentifierOrderedIteratorPolicy<String>(
- strategyOrdering);
- // exclude things that are not explicitly listed in the policy. That
- // way preference-based disablement will cause those strategies to
- // be excluded.
- policy.setExcludeNonExplicitValues(true);
- return policy;
- }
-
- protected final void doDispose()
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry: Disposing for project " //$NON-NLS-1$
- + _project.toString());
- }
-
- // call checkpoint to flush serializable data
- checkpoint();
- //_persistedTagStrategy.dispose();
-
- _nsResolved.clear();
- _changeOperations.clear();
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions
- .log("TLDTagRegistry: Done disposing registry for " //$NON-NLS-1$
- + _project.toString());
- }
- }
-
- @Override
- protected void cleanupPersistentState()
- {
- // TODO
- }
-
- public synchronized void checkpoint()
- {
- try
- {
- _persistedTagStrategy.save(_nsResolved);
- }
- catch (IOException e)
- {
- JSFCorePlugin.log(e, "Checkpointing JSP tags failed"); //$NON-NLS-1$
- }
- catch (ClassNotFoundException e)
- {
- JSFCorePlugin.log(e, "Checkpointing JSP tags failed"); //$NON-NLS-1$
- }
- }
-
- @Override
- protected Job getRefreshJob(final boolean flushCaches)
- {
- return new Job(Messages.TLDTagRegistry_RefreshJob + _project.getName())
- {
- @Override
- protected IStatus run(final IProgressMonitor monitor)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry.refresh: start"); //$NON-NLS-1$
- }
-
- synchronized (TLDTagRegistry.this)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions
- .log("TLDTagRegistry.refresh: start"); //$NON-NLS-1$
- }
-
- final List<Namespace> namespaces = new ArrayList(
- _nsResolved.values());
-
- if (flushCaches)
- {
- _persistedTagStrategy.clear();
- }
- // if we aren't flushing caches, then check point the
- // current namespace data, so it isn't lost when we clear
- // the namespaces
- else
- {
- checkpoint();
- }
-
- _nsResolved.clear();
-
- fireEvent(new TagRegistryChangeEvent(TLDTagRegistry.this,
- TagRegistryChangeEvent.EventType.REMOVED_NAMESPACE,
- namespaces));
- initialize(true);
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions
- .log("TLDTagRegistry.refresh: finished"); //$NON-NLS-1$
- }
- return Status.OK_STATUS;
- }
- }
- };
- }
-
- /**
- */
- private void initialize(boolean fireEvent)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry.initialize: start"); //$NON-NLS-1$
- }
-
- final ITaglibRecord[] tldrecs = TaglibIndex
- .getAvailableTaglibRecords(_project.getFullPath());
- final List<Namespace> affectedObjects = new ArrayList<Namespace>();
- for (final ITaglibRecord tldrec : tldrecs)
- {
- // defer the event
- final Namespace ns = initialize(tldrec, fireEvent);
-
- if (ns != null)
- {
- affectedObjects.add(ns);
- }
- }
-
- _hasBeenInitialized = true;
-
- // if tag index listener does exist, add it
- if (_tagIndexListener == null)
- {
- if (JSFCoreTraceOptions.TRACE_TLDREGISTRYMANAGER)
- {
- JSFCoreTraceOptions
- .log("TLDRegistryManager: installing tag index listener due to create instance for " //$NON-NLS-1$
- + _project.toString());
- }
-
- _tagIndexListener = new TagIndexListener(this);
- TaglibIndex.addTaglibIndexListener(_tagIndexListener);
- }
-
- // if (affectedObjects.size() > 0)
- // {
- // fireEvent(new TagRegistryChangeEvent(this,
- // TagRegistryChangeEvent.EventType.ADDED_NAMESPACE,
- // affectedObjects));
- // }
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry.initialize: finished"); //$NON-NLS-1$
- }
- }
-
- TLDNamespace initialize(final ITaglibRecord tagRecord,
- final boolean fireEvent)
- {
- if (tagRecord.getRecordType() == ITLDRecord.URL)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry.initialize_TagRecord: Initializing new tld record: "+tagRecord.toString()); //$NON-NLS-1$
- }
- long startTime = 0;
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF)
- {
- startTime = System.nanoTime();
- }
-
- final CMDocumentFactoryTLD factory = new CMDocumentFactoryTLD();
- final TLDDocument doc = (TLDDocument) factory
- .createCMDocument(tagRecord);
- if (doc != null)
- {
- final TLDNamespace ns = new TLDNamespace(doc, _resolver);
- _nsResolved.put(doc.getUri(), ns);
-
- if (fireEvent)
- {
- fireEvent(new TagRegistryChangeEvent(this,
- TagRegistryChangeEvent.EventType.ADDED_NAMESPACE,
- Collections.singletonList(ns)));
- }
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF)
- {
- System.out.printf("Time to update namespace %s was %d\n", //$NON-NLS-1$
- ns.getNSUri(), Long.valueOf(System.nanoTime()
- - startTime));
- }
- return ns;
- }
- }
- else
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry.initialize_TagRecord: Skipping tag record for "+tagRecord.toString()); //$NON-NLS-1$
- }
-
- }
- // no new namespace
- return null;
- }
-
- void remove(final ITaglibRecord tagRecord)
- {
- // this is safer, since we likely fail to create a TLDDocument for
- // a tagRecord that has been removed.
- final String uri = tagRecord.getDescriptor().getURI();
- final TLDNamespace ns = _nsResolved.remove(uri);
-
- if (ns != null)
- {
- fireEvent(new TagRegistryChangeEvent(this,
- TagRegistryChangeEvent.EventType.REMOVED_NAMESPACE,
- Collections.singletonList(ns)));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#getAllTagLibraries()
- */
- public final synchronized Collection<? extends Namespace> getAllTagLibraries()
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry.getAllTagLibraries: start"); //$NON-NLS-1$
- }
- long startTime = 0;
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF)
- {
- startTime = System.nanoTime();
- }
-
- if (!_hasBeenInitialized)
- {
- initialize(false);
- }
-
- final Set<TLDNamespace> allTagLibraries = new HashSet<TLDNamespace>();
- allTagLibraries.addAll(_nsResolved.values());
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_PERF)
- {
- System.out.println("Time to getAllTagLibraries for JSP: "+(System.nanoTime()-startTime)); //$NON-NLS-1$
- }
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions
- .log("TLDTagRegistry.getAllTagLibraries: finished"); //$NON-NLS-1$
- }
- return allTagLibraries;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry.ITagRegistry#getTagLibrary(java.lang.String)
- */
- public final synchronized Namespace getTagLibrary(final String uri)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions.log("TLDTagRegistry.getTagLibrary: start uri=" //$NON-NLS-1$
- + uri);
- }
-
- if (!_hasBeenInitialized)
- {
- initialize(false);
- }
-
- final Namespace ns = _nsResolved.get(uri);
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY)
- {
- JSFCoreTraceOptions
- .log("TLDTagRegistry.getTagLibrary: finished, result=" //$NON-NLS-1$
- + ns.toString());
- }
- return ns;
- }
-
- @Override
- public String toString()
- {
- return String
- .format(
- "TLDRegistry for project %s, isDisposed=%s, hasBeenInitialized=%s, numberOfNamespace=%d", //$NON-NLS-1$
- _project.toString(), Boolean.valueOf(isDisposed()),
- Boolean.valueOf(_hasBeenInitialized), Integer
- .valueOf(_nsResolved.size()));
- }
-
- void addLibraryOperation(final LibraryOperation operation)
- {
- _changeOperations.add(operation);
- _changeJob.schedule();
- }
-
-
- private class ChangeJob extends Job
- {
- private int _rescheduleTime = -1;
-
- public ChangeJob(final String projectName)
- {
- super(Messages.TLDTagRegistry_UpdateJob + projectName);
- }
-
- @Override
- protected IStatus run(final IProgressMonitor monitor)
- {
- synchronized (TLDTagRegistry.this)
- {
- _rescheduleTime = -1;
-
- LibraryOperation operation = null;
- final MultiStatus multiStatus = new MultiStatus(
- JSFCorePlugin.PLUGIN_ID, 0, "Result of change job", //$NON-NLS-1$
- new Throwable());
- while ((operation = _changeOperations.poll()) != null)
- {
- _rescheduleTime = 10000; // ms
-
- operation.run();
- multiStatus.add(operation.getResult());
- }
-
- if (_rescheduleTime >= 0 && !monitor.isCanceled())
- {
- // if any operations were found on this run, reschedule
- // to run again in 10seconds based on the assumption that
- // events may be coming in bursts
- schedule(_rescheduleTime);
- }
-
- return multiStatus;
- }
- }
- }
-
- private class MyPropertyListener extends TLDRegistryPreferences.PropertyListener
- {
- @Override
- public void strategyOrderChanged()
- {
- synchronized(TLDTagRegistry.this)
- {
- _prefs.load();
- final IdentifierOrderedIteratorPolicy<String> policy =
- getTagResolvingPolicy();
- _resolver.setPolicy(policy);
- }
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java
deleted file mode 100644
index b360a276f..000000000
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/registry/TagIndexListener.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 Oracle Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-/**
- *
- */
-package org.eclipse.jst.jsf.designtime.internal.view.model.jsp.registry;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.core.internal.JSFCoreTraceOptions;
-import org.eclipse.jst.jsp.core.taglib.ITaglibIndexDelta;
-import org.eclipse.jst.jsp.core.taglib.ITaglibIndexListener;
-
-class TagIndexListener implements ITaglibIndexListener
-{
- private final TLDTagRegistry _registry;
- private final LibraryOperationFactory _factory;
-
- TagIndexListener(final TLDTagRegistry registry)
- {
- _registry = registry;
- _factory = new LibraryOperationFactory(_registry);
- }
-
- public void indexChanged(final ITaglibIndexDelta delta)
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES)
- {
- JSFCoreTraceOptions.log("TagIndexListener.indexChanged: start"); //$NON-NLS-1$
- }
-
- visitDelta(delta);
-
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES)
- {
- JSFCoreTraceOptions.log("TagIndexListener.indexChanged: finish"); //$NON-NLS-1$
- }
- }
-
- private void visitDelta(final ITaglibIndexDelta delta)
- {
- final IProject project = delta.getProject();
-
- if (_registry != null && !_registry.isDisposed()
- && delta.getTaglibRecord() != null)
- {
- switch (delta.getKind())
- {
- case ITaglibIndexDelta.ADDED:
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES)
- {
- JSFCoreTraceOptions.log(String.format(
- "Processing add change: project=%s", project //$NON-NLS-1$
- .getName()));
- }
-
- _registry.addLibraryOperation(_factory
- .createAddOperation(delta.getTaglibRecord()));
- }
- break;
- case ITaglibIndexDelta.REMOVED:
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES)
- {
- JSFCoreTraceOptions
- .log(String
- .format(
- "Processing remove change: project=%s, tagrecord=%s", //$NON-NLS-1$
- project.getName()));
- }
- _registry.addLibraryOperation(_factory
- .createRemoveOperation(delta.getTaglibRecord()));
- }
- break;
- case ITaglibIndexDelta.CHANGED:
- {
- if (JSFCoreTraceOptions.TRACE_JSPTAGREGISTRY_CHANGES)
- {
- JSFCoreTraceOptions.log(String.format(
- "Processing change: project=%s, tagrecord=%s", //$NON-NLS-1$
- project.getName()));
- }
- _registry.addLibraryOperation(_factory
- .createChangeOperation(delta.getTaglibRecord()));
- }
- break;
- }
- }
-
- // visit children
- for (final ITaglibIndexDelta child : delta.getAffectedChildren())
- {
- visitDelta(child);
- }
- }
-} \ No newline at end of file

Back to the top