diff options
author | rsrinivasan | 2008-11-05 21:49:36 +0000 |
---|---|---|
committer | rsrinivasan | 2008-11-05 21:49:36 +0000 |
commit | d9f3ec874e20455ecdba99738ff36e075d195545 (patch) | |
tree | addd2b9b00f22f0fce9cd0918ddef94a8d55c5f8 /jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors | |
parent | 2ff89c3276101a20acdcb195ddae03c4ad07a549 (diff) | |
download | webtools.jsf-20081105.tar.gz webtools.jsf-20081105.tar.xz webtools.jsf-20081105.zip |
This commit was manufactured by cvs2svn to create tag 'v20081105'.v20081105
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors')
30 files changed, 0 insertions, 2098 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractMetaDataEnabledFeature.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractMetaDataEnabledFeature.java deleted file mode 100644 index c022bd901..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractMetaDataEnabledFeature.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IImageDescriptorProvider; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValues; - -/** - * Simple abstract class that implementers of {@link IMetaDataEnabledFeature} can subclass in the <b>TagLibDomain</b> of metadata - * <p><b>Provisional API - subject to change</b></p>* - */ -public abstract class AbstractMetaDataEnabledFeature implements IMetaDataEnabledFeature{ - - private MetaDataContext mdContext; - private IStructuredDocumentContext sdContext; - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#setMetaDataContext(org.eclipse.jst.jsf.metadataprocessors.MetaDataContext) - */ - public void setMetaDataContext(final MetaDataContext context) { - this.mdContext = context; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#getMetaDataContext() - */ - public MetaDataContext getMetaDataContext() { - return mdContext; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#setStructuredDocumentContext(org.eclipse.wtp.jsf.context.structureddocument.IStructuredDocumentContext) - */ - public void setStructuredDocumentContext(final IStructuredDocumentContext context) { - this.sdContext = context; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature#getStructuredDocumentContext() - */ - public IStructuredDocumentContext getStructuredDocumentContext() { - return sdContext; - } - -// private IProject getProject(){ -// if (_project == null){ -// _project = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(sdContext).getProject(); -// } -// return _project; -// } - - - //common metadata accessors - /** - * Return the single expected String value for a given property. - * - * @param traitName property name - * @return String value - */ - protected String getTraitValueAsString(final String traitName){ - Trait t = getTraitForEntityUsingContext(traitName); - if (t != null){ - return TraitValueHelper.getValueAsString(t); - } - - return null; - - } - - /** - * Return the List of values for a given property. - * - * @param traitName trait name - * @return List of String values - */ - protected List getTraitValueAsListOfStrings(final String traitName){ - Trait t = getTraitForEntityUsingContext(traitName); - if (t != null){ - return TraitValueHelper.getValueAsListOfStrings(t); - } - - return Collections.EMPTY_LIST; - } - - /** - * Return a boolean value for the given named trait . - * - * @param traitName property name - * @return boolean value. Returns false if trait was not located. - */ - protected boolean getTraitValueAsBoolean(final String traitName){ - Trait t = getTraitForEntityUsingContext(traitName); - if (t != null){ - return TraitValueHelper.getValueAsBoolean(t); - } - - return false; - - } - private Trait getTraitForEntityUsingContext(final String traitName) { - //look for trait on given entity - final Entity entity = getMetaDataContext().getEntity(); - return TaglibDomainMetaDataQueryHelper.getTrait(entity, traitName); - } - - /** - * @return small-icon name - */ - protected String getSmallIcon() { - return getTraitValueAsString(IPossibleValues.POSSIBLE_VALUES_SMALL_ICON_PROP_NAME); - } - - /** - * @return ImageDescriptor from the small-icon property for annotation from the same - * source model provider as the trait - */ - protected ImageDescriptor getImage() { - final String smallIcon = getSmallIcon(); - if (smallIcon == null) - return null; - - try { - Trait t = getMetaDataContext().getTrait(); - IMetaDataSourceModelProvider provider = t.getSourceModelProvider(); - IImageDescriptorProvider ip = (IImageDescriptorProvider)provider.getAdapter(IImageDescriptorProvider.class); - if (ip != null){ - return ip.getImageDescriptor(smallIcon); - } - } catch (RuntimeException e) { - //TODO: log error? - - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractRootTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractRootTypeDescriptor.java deleted file mode 100644 index 00b1ed842..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/AbstractRootTypeDescriptor.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jst.jsf.metadataprocessors.internal.IMetaDataEnabledFeatureExtension; -import org.eclipse.jst.jsf.metadataprocessors.internal.MetaDataEnabledFeatureAdapterFactory; -import org.eclipse.jst.jsf.metadataprocessors.internal.MetaDataEnabledFeatureRegistry; - - -/** - * Default implementation that a metadata type should strongly consider for using as it's root. - * This implementation allows for a class implementing {@link ITypeDescriptor} to also contain features so - * that it is not necessary to declare the features using the MetaDataEnabledFeatures ext-pt - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - */ -public abstract class AbstractRootTypeDescriptor extends AbstractMetaDataEnabledFeature - implements ITypeDescriptor { - - private IType type; - - /** - * Default implementation that will return <code>this</code> if it supports the processing feature, - * and all {@link IMetaDataEnabledFeature}s that also support this feature on this type. The caller can determine - * which one or more of the returned processors to use. - * - * @param processingFeature class - * @return List of <code>IMetaDataEnabledFeature</code>s that support the - * specified featureType interface. - * - * @see org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor#getFeatureAdapters(java.lang.Class) - */ - public List getFeatureAdapters(Class processingFeature) { - Assert.isTrue(processingFeature.isInterface()); - List ret = new ArrayList(3); - if (processingFeature.isInstance(this)) { -// ((IMetaDataEnabledFeature)this).setBundleID(type.getBundleID()); - ret.add(this); - } - - //add extensions here - ret.addAll(findMetaDataEnabledFeaturesForThisType(processingFeature)); - return ret; - - } - - /** - * This implementation relies on the the feature implementor using a subclass of AbstractRootTypeDescriptor - * which implements {@link IMetaDataEnabledFeature}. - * - * @param processingFeature - * @return list of <code>IMetaDataEnabledFeature</code>s - */ - protected final List<IMetaDataEnabledFeature> findMetaDataEnabledFeaturesForThisType(Class processingFeature) { - Map <String, IMetaDataEnabledFeature> mapOfFeatures = new HashMap<String, IMetaDataEnabledFeature>(); - List extensions = MetaDataEnabledFeatureRegistry.getInstance() - .getFeatures(getTypeExtension().getTypeID()); - - if (!extensions.isEmpty()){ - for (int i=0;i<extensions.size();i++){ - IMetaDataEnabledFeatureExtension aFeature = (IMetaDataEnabledFeatureExtension)extensions.get(i); - IMetaDataEnabledFeature feature = MetaDataEnabledFeatureAdapterFactory.getInstance().getFeatureAdapter(aFeature, processingFeature); - if (feature != null && processingFeature.isInstance(feature) - && ! mapOfFeatures.containsKey(aFeature.getClassName())){ - mapOfFeatures.put(aFeature.getClassName(),feature); - } - } - } - List<IMetaDataEnabledFeature> ret = new ArrayList<IMetaDataEnabledFeature>(mapOfFeatures.size()); - for (IMetaDataEnabledFeature feature: mapOfFeatures.values()){ - ret.add(feature); - } - return ret; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor#getRuntimeType() - */ - public IType getTypeExtension() { - return type; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor#setRuntimeType(org.eclipse.jst.jsf.metadataprocessors.internal.AbstractMetaDataEnabledType) - */ - public void setTypeExtension(IType type) { - this.type = type; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/DefaultTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/DefaultTypeDescriptor.java deleted file mode 100644 index 49b5ad916..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/DefaultTypeDescriptor.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - - -/** - * Type descriptor that is created if no class if provided for the implementation - * in the AttributeValueRuntimeTypes extension point. - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public class DefaultTypeDescriptor extends AbstractRootTypeDescriptor { - // abstract super contains no abstract methods, so do nothing: automatic default -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IMetaDataEnabledFeature.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IMetaDataEnabledFeature.java deleted file mode 100644 index f25054ddf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IMetaDataEnabledFeature.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; - -/** - * Required interface used by the MetaData feature processing framework. - * All features must extend this interface. - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public abstract interface IMetaDataEnabledFeature { - - /** - * Sets structured document context that this feature will operating on - * @param context - */ - public void setStructuredDocumentContext(IStructuredDocumentContext context); - - /** - * Gets structured document context that this feature will operating on - * @return IStructuredDocumentContext - */ - public IStructuredDocumentContext getStructuredDocumentContext(); - - /** - * Sets metadata model context that this feature will operating on - * @param context - */ - public void setMetaDataContext(MetaDataContext context); - - /** - * Gets metadata model context that this feature will be operating on. - * @return MetaDataContext - */ - public MetaDataContext getMetaDataContext(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IType.java deleted file mode 100644 index 7466b576c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/IType.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - - -/** - * Interface representing the information contained by the type registries. - * Encapsulates the IConfigurationElement information. - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public interface IType { - /** - * @return type id - */ - public String getTypeID(); - /** - * @return bundle id where it is defined - */ - public String getBundleID(); - /** - * @return classname for the type that must be located within the bundle - */ - public String getClassName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/ITypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/ITypeDescriptor.java deleted file mode 100644 index 0031ebb76..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/ITypeDescriptor.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.List; - -/** - * Interface describing the runtime type of a metadata enabled annotation. - * The type descriptor will load the feature adapters for a certain kind of - * feature that it supports. The type descriptor is registered by an extension point. - * <p><b>Provisional API - subject to change</b></p> - * @see IMetaDataEnabledFeature - * @see AbstractRootTypeDescriptor - * @see org.eclipse.jst.jsf.metadataprocessors.internal.AbstractMetaDataEnabledTypeFactory - * @see IType - * - * @author Gerry Kessler - Oracle - * - */ -public interface ITypeDescriptor { - /** - * @param type - * The IType must be set after the ITypeDescriptor is constructed - */ - public void setTypeExtension(IType type); - /** - * @return IType - * Must not be null - */ - public IType getTypeExtension(); - - /** - * @param processingFeature interface class - * @return List of <code>IMetaDataEnabledFeature</code>s that support the - * specified processingFeature interface. - */ - public List<IMetaDataEnabledFeature> getFeatureAdapters(Class processingFeature); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataContext.java deleted file mode 100644 index 5876340d2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataContext.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; - - -/** - * The current meta data model context being used for processing. - * <p><b>Provisional API - subject to change</b></p> - * - */ -public class MetaDataContext { - private Trait trait; - private Entity entity; - - /** - * Constructor - * @param entity - * @param trait - */ - public MetaDataContext(Entity entity, Trait trait) { - this.entity = entity; - this.trait = trait; - } - - /** - * @return Entity - */ - public Entity getEntity(){ - return entity; - } - /** - * @return Trait - */ - public Trait getTrait(){ - return trait; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataEnabledProcessingFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataEnabledProcessingFactory.java deleted file mode 100644 index 0b3f15782..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/MetaDataEnabledProcessingFactory.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.dom.AttributeIdentifier; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.TraitValueHelper; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; -import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; -import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; -import org.eclipse.jst.jsf.metadataprocessors.internal.AttributeValueRuntimeTypeFactory; - -/** - * Singleton class that will produce <code>IMetaDataEnabledFeature</code>s - * that the caller can use for processing. - * <p> - * <b>Provisional API - subject to change</b> - * </p> - * - * @author Gerry Kessler - Oracle - * - */ -public final class MetaDataEnabledProcessingFactory { - private static MetaDataEnabledProcessingFactory INSTANCE; - - /** - * Name of property in annotation file to use when applying a runtime type - * to an attribute value - */ - public static final String ATTRIBUTE_VALUE_RUNTIME_TYPE_PROP_NAME = "attribute-value-runtime-type"; - - /** - * @return singleton instance - */ - public static MetaDataEnabledProcessingFactory getInstance() { - if (INSTANCE == null) { - INSTANCE = new MetaDataEnabledProcessingFactory(); - } - return INSTANCE; - } - - private MetaDataEnabledProcessingFactory() { - super(); - } - - /** - * Returns list of <code>IMetaDataEnabledFeature</code> adapters for the - * given Taglibrary attribute. - * - * Adapters will be scanned for first by uri, element, attribute and if not - * found, uri, "*", attribute and if still not found by "*", "*", attribute. - * - * @param featureType - * feature type. eg. <code>IPossibleValues</code>, - * <code>IValidValues</code>, etc. Must be subclass of - * IMetaDataEnabledFeature. - * @param sdContext - * @param uri - * annotation file uri - * @param elementName - * @param attributeName - * @return returns null - if the metadata was not found <br> - * returns empty list - if not a - * <code>IMetaDataEnabledFeature</code> processor or is not valid - * or does not support the specified feature - * - * @see MetaDataEnabledProcessingFactory#ATTRIBUTE_VALUE_RUNTIME_TYPE_PROP_NAME - */ - public List<IMetaDataEnabledFeature> getAttributeValueRuntimeTypeFeatureProcessors( - Class featureType, IStructuredDocumentContext sdContext, - String uri, String elementName, String attributeName) { - - // look up the attribute's runtime type from MD - IProject _project = null; - if (sdContext != null) { - IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE - .getWorkspaceContextResolver(sdContext); - _project = resolver != null ? resolver.getProject() : null; - } - String _elem = elementName + "/" + attributeName; - String _uri = uri; - ITaglibDomainMetaDataModelContext modelContext = TaglibDomainMetaDataQueryHelper - .createMetaDataModelContext(_project, _uri); - Entity attrEntity = TaglibDomainMetaDataQueryHelper.getEntity(modelContext, - _elem); - - if (attrEntity != null) - return getAttributeValueRuntimeTypeFeatureProcessors(featureType, sdContext, attrEntity); - - return Collections.EMPTY_LIST; - - } - - /** - * A convenience method fully equivalent to: - * - * getAttributeValueRuntimeTypeFeatureProcessors - * (featureType, sdContext, attributeId.getTagIdentifier().getUri() - * , attributeId.getTagIdentifier().getTagName(), - * attributeId.getName()) - * @param featureType - * @param sdContext - * @param attributeId - * @return the meta-data enabled feature - */ - public List<IMetaDataEnabledFeature> getAttributeValueRuntimeTypeFeatureProcessors( - Class featureType, IStructuredDocumentContext sdContext, - AttributeIdentifier attributeId) - { - return getAttributeValueRuntimeTypeFeatureProcessors - (featureType, sdContext, attributeId.getTagIdentifier().getUri() - , attributeId.getTagIdentifier().getTagName(), - attributeId.getName()); - } - - /** - * @param featureType - * @param sdContext - * @param attrEntity - * @return returns null - if the meta data was not found <br> - * returns empty list - if not a - * <code>IMetaDataEnabledFeature</code> processor or is not valid - * or does not support the specified feature - */ - public List<IMetaDataEnabledFeature> getAttributeValueRuntimeTypeFeatureProcessors( - Class featureType, IStructuredDocumentContext sdContext, - Entity attrEntity) { - - Trait trait = TaglibDomainMetaDataQueryHelper.getTrait(attrEntity, - ATTRIBUTE_VALUE_RUNTIME_TYPE_PROP_NAME); - - if (trait == null) { - return Collections.EMPTY_LIST; - } - - List<IMetaDataEnabledFeature> retList = new ArrayList<IMetaDataEnabledFeature>(2); - String typeId = TraitValueHelper.getValueAsString(trait); - - // get the implementing class for the type - ITypeDescriptor type = AttributeValueRuntimeTypeFactory.getInstance() - .getType(typeId); - if (type != null) { - MetaDataContext context = new MetaDataContext(attrEntity, trait); - // get all the feature adapters (IMetaDataEnabledFeature) for this - // type - List<IMetaDataEnabledFeature> featureAdapters = type.getFeatureAdapters(featureType); - for (int j = 0; j < featureAdapters.size(); j++) { - // set the context in the feature - featureAdapters.get(j).setMetaDataContext(context); - featureAdapters.get(j).setStructuredDocumentContext(sdContext); - retList.add(featureAdapters.get(j)); - } - - } - // return list of IMetaDataEnabledFeatures for this type - return Collections.unmodifiableList(retList); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/TaglibMetadataContext.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/TaglibMetadataContext.java deleted file mode 100644 index 71809e830..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/TaglibMetadataContext.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 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.metadataprocessors; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Binds tag library context to the metadata context - * <p><b>Provisional API - subject to change</b></p> - * @deprecated - should not have been public, and no reason anyone should be using this class - */ -public class TaglibMetadataContext extends MetaDataContext { - - private String uri; - private String tagName; - private String attributeName; - - /** - * Constructor - * - * @param uri - must not be null - * @param tagName - must not be null - * @param attributeName - may be null - * @param entity - the metadata entity represented by the tag or attribute - * @param trait - the metadata trait of interest - */ - public TaglibMetadataContext(String uri, String tagName, String attributeName, Entity entity, Trait trait){ - super(entity, trait); - this.uri = uri; - this.tagName = tagName; - this.attributeName = attributeName; - } - - /** - * Package-private Constructor - * - * @param tagAttrEntity - must be tag attribute entity and not null - * @param trait - */ - /*package*/ TaglibMetadataContext(Entity tagAttrEntity, Trait trait){ - super(tagAttrEntity, trait); - Assert.isNotNull(tagAttrEntity); - this.uri = tagAttrEntity.getModel().getCurrentModelContext().getUri(); - if (!(tagAttrEntity.eContainer() instanceof Entity)) - { - throw new IllegalArgumentException("tagAttrEntity must be contained in a tag Entity to use this constructor"); - } - this.tagName = ((Entity)tagAttrEntity.eContainer()).getId(); - this.attributeName = tagAttrEntity.getId(); - } - - /** - * @return URI - */ - public String getUri() { - return uri; - } - - /** - * @return Tag name - should not be null - */ - public String getTagName() { - return tagName; - } - - /** - * @return Attribute name - may be null - */ - public String getAttributeName() { - return attributeName; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ELIsNotValidException.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ELIsNotValidException.java deleted file mode 100644 index f1b5b1698..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ELIsNotValidException.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -/** - * Exception - * - * <p><b>Provisional API - subject to change</b></p> - */ -public class ELIsNotValidException extends Exception { - private static final long serialVersionUID = 1L; - - /** - * Constructor - * @param msg - */ - public ELIsNotValidException(String msg){ - super(msg); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ICreateValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ICreateValues.java deleted file mode 100644 index 6c25a65d8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ICreateValues.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * @author Gerry Kessler - Oracle - * - * Experimental - not currently used - * <p><b>Provisional API - subject to change</b></p> - * - */ -public interface ICreateValues extends IMetaDataEnabledFeature{ - /** - * @return object created - */ - public Object createValue(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IDefaultValue.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IDefaultValue.java deleted file mode 100644 index 93d93b812..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IDefaultValue.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * Interface providing a default value. - * - * @author Gerry Kessler - Oracle - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public interface IDefaultValue extends IMetaDataEnabledFeature { - /** - * Default name of property in annotation file to use when supplying default values from meta-data - */ - String DEFAULT_VALUE_PROP_NAME = "default-value"; - - /** - * @return default value or null if one not defined - */ - public String getDefaultValue(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValue.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValue.java deleted file mode 100644 index d4cdbf955..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValue.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Interface for providing lists of possible values - * Values can be different than displayed values. - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public interface IPossibleValue { - /** - * @return value to set. should not return null. - */ - public String getValue(); - /** - * @return value to display in a proposal which can be different than what is set. Must not return null. - */ - public String getDisplayValue(); - /** - * @return ImageDescriptor for image to be displayed in a proposal. May be null. - */ - public ImageDescriptor getIcon(); - /** - * @return true if is known to be the default value. - */ - public boolean isDefaultValue(); - - /** - * @return additional information that could be used for descriptive help - * May be null - */ - public String getAdditionalInformation(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValues.java deleted file mode 100644 index 4d43d8706..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IPossibleValues.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * Interface for providing possible values. - * - * <p><b>Provisional API - subject to change</b></p> - * @author Gerry Kessler - Oracle - * - */ -public interface IPossibleValues extends IMetaDataEnabledFeature{ - - /** - * Default name of property in annotation file to use when supplying possible values from meta-data - */ - public static final String POSSIBLE_VALUES_PROP_NAME = "valid-values"; - /** - * Default name of property in annotation file to use when supplying possible displayed values from meta-data - */ - public static final String POSSIBLE_VALUES_FOR_DISPLAY_PROP_NAME = "displayed-values"; - /** - * Default name of property in annotation file to use when supplying icon displayed values from meta-data - */ - public static final String POSSIBLE_VALUES_SMALL_ICON_PROP_NAME = "small-icon"; - /** - * @return List of IPossibleValue instances representing possible values - * Implementer must ensure that an empty rather than null list is returned if no values are posssible. - */ - public List getPossibleValues(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidELValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidELValues.java deleted file mode 100644 index ca0b8f697..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidELValues.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jst.jsf.common.internal.types.CompositeType; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * An {@link IMetaDataEnabledFeature} for semantic validation of EL Values - * - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IValidELValues extends IMetaDataEnabledFeature { - /** - * Expected runtime type for EL value - * @return CompositeType - * @throws ELIsNotValidException - */ - public CompositeType getExpectedRuntimeType() throws ELIsNotValidException; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidValues.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidValues.java deleted file mode 100644 index 25baa406a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidValues.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import java.util.List; - -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; - -/** - * An {@link IMetaDataEnabledFeature} for validating values using metadata - * - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IValidValues extends IMetaDataEnabledFeature{ - /** - * Trait name for valid-values - */ - public static final String VALID_VALUES_PROP_NAME = "valid-values"; - - /** - * Trait name for valid-values-code - */ - public static final String VALID_VALUES_CODE_PROP_NAME = VALID_VALUES_PROP_NAME + "-code"; - /** - * Trait name for valid-values-severity - */ - public static final String VALID_VALUES_SEVERITY_PROP_NAME = VALID_VALUES_PROP_NAME + "-severity"; - /** - * Trait name for valid-values-message - */ - public static final String VALID_VALUES_MESSAGE_PROP_NAME = VALID_VALUES_PROP_NAME + "-message"; - /** - * Trait name for valid-maximum - */ - public static final String VALID_VALUES_MAX_PROP_NAME = "valid-maximum"; - /** - * Trait name for valid-minimum - */ - public static final String VALID_VALUES_MIN_PROP_NAME = "valid-minimum"; - /** - * @param value fully resolved value as String - * @return true if is valid - */ - public boolean isValidValue(String value); - /** - * @return List of IValidationMessage objects if invalid - * Must return empty list rather than null - * Call to isValidValue(String value) required before this should be called. - */ - public List getValidationMessages(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidationMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidationMessage.java deleted file mode 100644 index 4f29c782d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/IValidationMessage.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -/** - * Interface for validation messages for metadata features - * - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IValidationMessage { - /** - * @return localized string desribing validation issue - * Should not be null; - */ - public String getMessage(); - - /** - * @return String representing a validation code associated with validation issue - * Can return null - */ - public String getCode(); - - /** - * @return integer value representing severity. - * Valid values are 0 (IStatus.INFO), 1 (IStatus.WARNING) and 4 (IStatus.ERROR) - */ - public int getSeverity(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/PossibleValue.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/PossibleValue.java deleted file mode 100644 index dbbde0636..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/PossibleValue.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.jface.resource.ImageDescriptor; - - -/** - * Implements {@link IPossibleValues} - * - * <p><b>Provisional API - subject to change</b></p> - * - */ -public class PossibleValue implements IPossibleValue { - private String value; - private String displayValue; - private ImageDescriptor smallIcon; - private boolean isDefault = false; - private String additionalInfo; - - /** - * Constructor when display value is same as stored value - * @param value - */ - public PossibleValue(String value){ - this.value = value; - } - - /** - * Constructor when display-value may be different than stored value - * @param value - * @param displayValue - */ - public PossibleValue(String value, String displayValue){ - this.value = value; - this.displayValue = displayValue; - } - - /** - * Constructor when display-value may be different than stored value - * and a default value is known - * @param value - * @param displayValue - * @param isDefaultValue - */ - public PossibleValue(String value, String displayValue, boolean isDefaultValue) { - this.value = value; - this.displayValue = displayValue; - this.isDefault = isDefaultValue; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getValue() - */ - public String getValue() { - return value; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getDisplayValue() - */ - public String getDisplayValue() { - if (displayValue == null) - return value; - return displayValue; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getIcon() - */ - public ImageDescriptor getIcon() { - return smallIcon; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#isDefaultValue() - */ - public boolean isDefaultValue() { - return isDefault; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IPossibleValue#getAdditionalInformation() - */ - public String getAdditionalInformation() { - return additionalInfo; - } - - /** - * @param value - */ - public void setValue(String value) { - this.value = value; - } - - /** - * @param displayValue - */ - public void setDisplayValue(String displayValue) { - this.displayValue = displayValue; - } - - /** - * @param smallIcon - */ - public void setIcon(ImageDescriptor smallIcon) { - this.smallIcon = smallIcon; - } - - /** - * @param isDefault - */ - public void setIsDefault(boolean isDefault) { - this.isDefault = isDefault; - } - - /** - * @param additionalInfo - */ - public void setAdditionalInformation(String additionalInfo){ - this.additionalInfo = additionalInfo; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ValidationMessage.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ValidationMessage.java deleted file mode 100644 index 5aaf29e1a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/ValidationMessage.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.features; - -import org.eclipse.core.runtime.IStatus; - -/** - * Metadata Validation Message implementation - * - * <p><b>Provisional API - subject to change</b></p> - */ -public class ValidationMessage implements IValidationMessage { - - private String code; - private String msg; - private int severity = IStatus.WARNING; - - /** - * Constructor - * @param msg - */ - public ValidationMessage(String msg){ - this.msg = msg; - } - - /** - * Constructor - * @param msg - * @param code - * @param severity - */ - public ValidationMessage(String msg, String code, int severity){ - this.msg = msg; - this.code = code; - this.severity = severity; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage#getMessage() - */ - public String getMessage() { - return msg; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage#getCode() - */ - public String getCode() { - return code; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.features.IValidationMessage#getSeverity() - */ - public int getSeverity() { - return severity; - } - - /** - * @param msg - */ - public void setMessage(String msg) { - this.msg = msg; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/package-info.java deleted file mode 100644 index 552ffe61c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/features/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Provides tooling services for tag attribute values - * based on the org.eclipse.jst.jsf.core.AttributeValueRuntimeTypes. - * <p> - * New features can added to the system using the org.eclipse.jst.jsf.core.MetaDataEnabledFeatures - * extension-point. This extension point provides the binding of a AttributeValueRuntimeTypes to a feature - * so that new behaviors can be added to existing types. - * - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.metadataprocessors.features; diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledType.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledType.java deleted file mode 100644 index 0ae2de2d7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledType.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import org.eclipse.jst.jsf.metadataprocessors.IType; - - -/** - * Class that encapuslates the information from the - * <code>AttributeValueRuntimeTypes</code> and - * <code>MetaDataEnabledFeatures</code> - * extension points. - * - * @author Gerry Kessler - Oracle - * - */ -public class AbstractMetaDataEnabledType implements IType{ - String typeId; - String bundleId; - String klass; - - AbstractMetaDataEnabledType(String bundleID, String id, String klass){ - this.bundleId = bundleID; - this.typeId = bundleId + "." + id; - this.klass = klass; - } - - public String getTypeID(){ - return typeId; - } - - public String getBundleID(){ - return bundleId; - } - - public String getClassName(){ - return klass; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeFactory.java deleted file mode 100644 index 6e2d1f48c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeFactory.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.IType; -import org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor; -import org.osgi.framework.Bundle; - -/** - * Abstract factory producing <code>ITypeDescriptor</code>s - * from instances of <code>AbstractMetaDataEnabledType</code>s - * - * @author Gerry Kessler - Oracle - * - */ -public abstract class AbstractMetaDataEnabledTypeFactory { - /** - * The factory instance - * TODO: why is this defined here it is only used in sub-classes?? - */ - protected static AbstractMetaDataEnabledTypeFactory INSTANCE; - - /** - * No arg constructor - */ - protected AbstractMetaDataEnabledTypeFactory(){ - super(); - } - - /** - * Concrete factory must pass instances of the it's types. - * - * @param typeId - * @return list of instances identified by the type id - */ - public abstract ITypeDescriptor getType(String typeId); - - /** - * @param type - * @return instance of ITypeDescriptor identified by the type id - */ - public ITypeDescriptor getType(AbstractMetaDataEnabledType type){ - - return createType(type); - - } - - /** - * @param type - * @return class identified by the type id - */ - public Class getClassForType(IType type){ - return createTypeClass(type); - - } - - /** - * Creates instances of <code>ITypeDescriptor</code>s from - * <code>AbstractMetaDataEnabledType</code>s - * - * @param atype - * @return the meta-data type descriptor - */ - protected ITypeDescriptor createType(IType atype){ - if (atype != null){ - ITypeDescriptor desc = createDescriptorInstance(atype); - if (desc != null){ - desc.setTypeExtension(atype); - return desc; - } - } - return null; - } - - - private Class createTypeClass(IType type){ - String className = type.getClassName(); - try { - Bundle bundle =Platform.getBundle(type.getBundleID()); - if (bundle == null){ - JSFCorePlugin.log(IStatus.ERROR, type.getBundleID() + " could not be created to load " + className); - return null; - } - Class klass = bundle.loadClass(className); - if (klass != null){ - //make sure the class can support the feature/extended interface - if (ITypeDescriptor.class.isAssignableFrom(klass)) - { - return klass; - } - JSFCorePlugin.log(IStatus.INFO, className + " was not found in " + type.getBundleID() +" for " + type.getTypeID()); - } - } catch (ClassNotFoundException e) { - JSFCorePlugin.log(IStatus.ERROR, className + " was not found in " + type.getBundleID() +" for " + type.getTypeID()); - } - return null; - } - - private ITypeDescriptor createDescriptorInstance(IType type){ - String className = type.getClassName(); - try { - Class klass = createTypeClass(type); - if (klass != null){ - return (ITypeDescriptor)klass.newInstance(); - } - } catch (InstantiationException e) { - JSFCorePlugin.log(IStatus.ERROR, "InstantiationException: " + className + " in " + type.getBundleID() +" for " + type.getTypeID()); - } catch (IllegalAccessException e) { - JSFCorePlugin.log(IStatus.ERROR, "IllegalAccessException: " + className + " in " + type.getBundleID() +" for " + type.getTypeID()); - } - return null; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeRegistry.java deleted file mode 100644 index 5c4b0b2c0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeRegistry.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import java.util.HashMap; - -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; - -/** - * Abstract registry of <code>AbstractMetaDataEnabledType<code> - * mapped by type id. - * - * @author Gerry Kessler - Oracle - * - */ -public abstract class AbstractMetaDataEnabledTypeRegistry { - private final HashMap typeMap; //map of types keyed by id - private final String ext_pt_id; //type ext-pt id - - /** - * @param extPtId - */ - public AbstractMetaDataEnabledTypeRegistry(String extPtId){ - typeMap = new HashMap(); - ext_pt_id = extPtId; - - readRegistry(); - } - - /** - * @param bundleID - * @param id - * @param klass - * @param runtimeType - */ - protected void registerType(String bundleID, String id, String klass, String runtimeType){ - AbstractMetaDataEnabledType atype = new AbstractMetaDataEnabledType(bundleID, id, klass); - if (!typeMap.containsKey(atype.getTypeID())){ - typeMap.put(atype.getTypeID(), atype); - } - else { - //is there any point in putting this more in the user's face? this is really an internal error. - JSFCorePlugin.log(IStatus.ERROR, "Duplicate RuntimeTypeId being registered from " + ext_pt_id + ": " + atype.getTypeID()); - } - } - - /** - * Return the metadata enabled type for the given id - * @param id - * @return type - */ - public AbstractMetaDataEnabledType getType(String id){ - if (typeMap.containsKey(id)) - { - return (AbstractMetaDataEnabledType)typeMap.get(id); - } - return null; - } - - /** - * Reads the extensions for a particular type id - */ - protected void readRegistry() { - try { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(JSFCorePlugin.PLUGIN_ID, ext_pt_id); - IExtension[] extensions = point.getExtensions(); - for (int i=0;i < extensions.length;i++){ - IExtension ext = extensions[i]; - for (int j=0;j < ext.getConfigurationElements().length;j++){ - final String bundleId = ext.getConfigurationElements()[j].getContributor().getName(); - final String id = ext.getConfigurationElements()[j].getAttribute("id"); - String klass = ext.getConfigurationElements()[j].getAttribute("class"); - final String runtimeType = ext.getConfigurationElements()[j].getAttribute("runtime-type"); - if (klass == null || klass.trim().equals("")){ - klass = getDefaultClassName(); - } - registerType(bundleId, id, klass, runtimeType); - } - } - } catch (InvalidRegistryObjectException e) { - JSFCorePlugin.log(e, "Unable to read " + JSFCorePlugin.PLUGIN_ID + ext_pt_id + " registry"); - } - } - - /** - * @return default classname to use for the type - */ - protected abstract String getDefaultClassName(); - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeFactory.java deleted file mode 100644 index 78638e287..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor; - - -/** - * Factory producing <code>IMetaDataEnabledFeature</code>s from - * <code>AttributeValueRuntimeType</code> objects - * - * @author Gerry Kessler - Oracle - * - */ -public class AttributeValueRuntimeTypeFactory extends AbstractMetaDataEnabledTypeFactory{ - - /** - * @return the single instance... TODO: why is this allocated here if it is - * declared in super? - */ - public static AttributeValueRuntimeTypeFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new AttributeValueRuntimeTypeFactory(); - } - return (AttributeValueRuntimeTypeFactory)INSTANCE; - } - - private AttributeValueRuntimeTypeFactory(){ - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.metadataprocessors.internal.AbstractMetaDataEnabledTypeFactory#getType(java.lang.String) - */ - public ITypeDescriptor getType(String typeId){ - - return createType(AttributeValueRuntimeTypeRegistry.getInstance().getType(typeId)); - - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeRegistry.java deleted file mode 100644 index 9deab17ae..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeRegistry.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -/** - * Registry of <code>AbstractMetaDataEnabledType</code>s that are loaded from - * the <code>AttributeValueRuntimeValueType</code> extension point - * - * @author Gerry Kessler - Oracle - * - */ -public class AttributeValueRuntimeTypeRegistry extends AbstractMetaDataEnabledTypeRegistry { - - private static final String EXTPTID = "AttributeValueRuntimeTypes"; - private static final String DEFAULT_CLASS = "org.eclipse.jst.jsf.metadataprocessors.DefaultTypeDescriptor"; - private static AttributeValueRuntimeTypeRegistry INSTANCE; - - /** - * @return singleton instance - */ - public static AttributeValueRuntimeTypeRegistry getInstance(){ - if (INSTANCE == null){ - INSTANCE = new AttributeValueRuntimeTypeRegistry(); - } - return INSTANCE; - } - - private AttributeValueRuntimeTypeRegistry(){ - super(EXTPTID); - } - - protected String getDefaultClassName() { - return DEFAULT_CLASS; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/IMetaDataEnabledFeatureExtension.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/IMetaDataEnabledFeatureExtension.java deleted file mode 100644 index bde9ca613..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/IMetaDataEnabledFeatureExtension.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -/** - * Interface used to bind feature extensions to metadata enabled types - * - */ -public interface IMetaDataEnabledFeatureExtension { - /** - * @return bundle id - */ - public String getBundleID(); - /** - * @return type id - */ - public String getTypeID(); - /** - * @return class name to use for type. Must be located within the bundle. - */ - public String getClassName(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureAdapterFactory.java deleted file mode 100644 index 9cb0303d0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureAdapterFactory.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.IMetaDataEnabledFeature; -import org.eclipse.jst.jsf.metadataprocessors.IType; -import org.eclipse.jst.jsf.metadataprocessors.ITypeDescriptor; -import org.osgi.framework.Bundle; - -/** - * Factory producing <code>IMetaDataEnabledFeature</code>s from - * <code>IType</code> objects that implement a specified feature - * - * @author Gerry Kessler - Oracle - * - */ -public final class MetaDataEnabledFeatureAdapterFactory { - private static MetaDataEnabledFeatureAdapterFactory INSTANCE; - private Map<String, Class> typesCache; - /** - * @return singleton instance - */ - public static MetaDataEnabledFeatureAdapterFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new MetaDataEnabledFeatureAdapterFactory(); - } - return INSTANCE; - } - - private MetaDataEnabledFeatureAdapterFactory(){ - super(); - typesCache = new HashMap<String, Class>(); - } - - - /** - * Given the feature extension, create and return the {@link IMetaDataEnabledFeature} for a given processing feature - * @param feature - * @param processingFeature class - * @return IMetaDataEnabledFeature - */ - public IMetaDataEnabledFeature getFeatureAdapter(IMetaDataEnabledFeatureExtension feature, Class processingFeature){ - if (feature != null){ - return createFeature(feature, processingFeature); - } - return null; - } - - /** - * Given the feature extension, create and return the {@link IMetaDataEnabledFeature} for a given processing feature if - * that the type that the feature is bound to is a subclass of the the type - * @param feature - * @param processingFeature class - * @param type - * @return IMetaDataEnabledFeature. <br>Will return null if the type that the feature extension is bound to, - * is not a subclass of the supplied type - */ - public IMetaDataEnabledFeature getFeatureAdapterForSubclass(IMetaDataEnabledFeatureExtension feature, Class processingFeature, IType type){ - if (feature != null ){ - ITypeDescriptor aType = AttributeValueRuntimeTypeFactory.getInstance().getType(feature.getTypeID()); - Class klass = aType.getTypeExtension().getClass(); - if (klass.asSubclass(type.getClass()) != null) - return createFeature(feature, processingFeature); - } - return null; - } - -// private Class getOrCreateTypeClassFor(IMetaDataEnabledFeatureExtension featureExt){ -// Class klass = null; -// String className; -// ITypeDescriptor type = AttributeValueRuntimeTypeFactory.getInstance().getType(featureExt.getTypeID()); -// try { -// if (! typesCache.containsKey(featureExt.getTypeID())){ -// Bundle bundle =Platform.getBundle(featureExt.getBundleID()); -// if (bundle == null){ -// JSFCorePlugin.log(IStatus.ERROR, featureExt.getBundleID() + " could not be created to load " + className); -// return null; -// } -// klass = bundle.loadClass(className); -// if (klass != null){ -// typesCache.put(featureExt.getTypeID(), klass); -// } -// } -// else -// klass = typesCache.get(featureExt.getTypeID()); -// -// return klass; -// if (!IMetaDataEnabledFeature.class.isAssignableFrom(klass)){ -// JSFCorePlugin.log(IStatus.INFO, className + " is not a IMetaDataEnabledFeature. " + featureExt.getBundleID() +" : " + featureExt.getTypeID()); -// } -// else if (klass != null && processingFeature.isAssignableFrom(klass)){ -// IMetaDataEnabledFeature obj = (IMetaDataEnabledFeature)klass.newInstance(); -// return obj; -// } -// -// } catch (ClassNotFoundException e) { -// JSFCorePlugin.log(IStatus.ERROR, className + " was not found in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); -// } catch (InstantiationException e) { -// JSFCorePlugin.log(IStatus.ERROR, "InstantiationException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); -// } catch (IllegalAccessException e) { -// JSFCorePlugin.log(IStatus.ERROR, "IllegalAccessException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); -// } -// return null; -// } - - private IMetaDataEnabledFeature createFeature(IMetaDataEnabledFeatureExtension featureExt, Class processingFeature){ - String className = featureExt.getClassName(); - Class klass = null; - try { - if (! typesCache.containsKey(featureExt.getTypeID())){ - Bundle bundle =Platform.getBundle(featureExt.getBundleID()); - if (bundle == null){ - JSFCorePlugin.log(IStatus.ERROR, featureExt.getBundleID() + " could not be created to load " + className); - return null; - } - klass = bundle.loadClass(className); - if (klass != null){ - typesCache.put(featureExt.getTypeID(), klass); - } - } - else - klass = typesCache.get(featureExt.getTypeID()); - - if (!IMetaDataEnabledFeature.class.isAssignableFrom(klass)){ - JSFCorePlugin.log(IStatus.INFO, className + " is not a IMetaDataEnabledFeature. " + featureExt.getBundleID() +" : " + featureExt.getTypeID()); - } - else if (klass != null && processingFeature.isAssignableFrom(klass)){ - IMetaDataEnabledFeature obj = (IMetaDataEnabledFeature)klass.newInstance(); - return obj; - } - - } catch (ClassNotFoundException e) { - JSFCorePlugin.log(IStatus.ERROR, className + " was not found in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); - } catch (InstantiationException e) { - JSFCorePlugin.log(IStatus.ERROR, "InstantiationException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); - } catch (IllegalAccessException e) { - JSFCorePlugin.log(IStatus.ERROR, "IllegalAccessException: " + className + " in " + featureExt.getBundleID() +" for " + featureExt.getTypeID()); - } - return null; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureExtension.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureExtension.java deleted file mode 100644 index ae90a9a5e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureExtension.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - - -/** - * - * @author Gerry Kessler - Oracle - * - */ -public class MetaDataEnabledFeatureExtension implements IMetaDataEnabledFeatureExtension{ - - private String klass; - private String typeId; - private String bundleId; - - MetaDataEnabledFeatureExtension(String bundleID, String typeId, String klass) { - this.bundleId = bundleID; - this.typeId = typeId; - this.klass = klass; - } - - public String getBundleID() { - return bundleId; - } - - public String getClassName() { - return klass; - } - - public String getTypeID() { - return typeId; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureRegistry.java deleted file mode 100644 index 17b5a41e4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureRegistry.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.metadataprocessors.internal; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.core.internal.JSFCorePlugin; -import org.eclipse.jst.jsf.metadataprocessors.IType; - -/** - * Registry of <code>AbstractMetaDataEnabledType</code>s loaded from - * the <code>MetaDataEnabledFeatures</code> extension point - * - * A map of features keyed by type id - * - */ -public class MetaDataEnabledFeatureRegistry{ - private static final String EXTPTID = "MetaDataEnabledFeatures"; - private Map<String, List<IMetaDataEnabledFeatureExtension>> featuresMap; - private Map<String, Class> typeCacheMap; - private static MetaDataEnabledFeatureRegistry INSTANCE; - - /** - * @return the singleton instance of the MetaDataEnabledFeatureRegistry - */ - public static synchronized MetaDataEnabledFeatureRegistry getInstance(){ - if (INSTANCE == null){ - INSTANCE = new MetaDataEnabledFeatureRegistry(); - } - return INSTANCE; - } - - private MetaDataEnabledFeatureRegistry(){ - featuresMap = new HashMap<String, List<IMetaDataEnabledFeatureExtension>>(); - typeCacheMap = new HashMap<String, Class>(); - readRegistry(); - } - - /** - * Reads the MetaDataEnabledFeatures extensions into a registry - */ - protected void readRegistry() { - try { - IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(JSFCorePlugin.PLUGIN_ID, EXTPTID); - IExtension[] extensions = point.getExtensions(); - for (int i=0;i < extensions.length;i++){ - IExtension ext = extensions[i]; - for (int j=0;j < ext.getConfigurationElements().length;j++){ - final String bundleId = ext.getConfigurationElements()[j].getContributor().getName(); - final String id = ext.getConfigurationElements()[j].getAttribute("typeid"); - final String klass = ext.getConfigurationElements()[j].getAttribute("class"); - registerFeature(bundleId, id, klass); - } - } - } catch (InvalidRegistryObjectException e) { - JSFCorePlugin.log(e, "Unable to read " + JSFCorePlugin.PLUGIN_ID + EXTPTID + " registry"); - } - } - - /** - * Create {@link IMetaDataEnabledFeatureExtension}s and add to registry - * @param bundleID - * @param typeId - * @param klass - */ - protected void registerFeature(String bundleID, String typeId, String klass){ - IMetaDataEnabledFeatureExtension aFeature = new MetaDataEnabledFeatureExtension(bundleID, typeId, klass); - if (canCreateTypeForFeatureExtension(aFeature)){ - if (!featuresMap.containsKey(typeId)){ - List list = new ArrayList(); - list.add(aFeature); - featuresMap.put(typeId, list); - } - else { - List list = featuresMap.get(typeId); - list.add(aFeature); - } - } - } - - - private boolean canCreateTypeForFeatureExtension(IMetaDataEnabledFeatureExtension feature) { - if (! typeCacheMap.containsKey(feature.getTypeID())){ - IType type = AttributeValueRuntimeTypeRegistry.getInstance().getType(feature.getTypeID()); - if (type != null){ - Class typeClass = AttributeValueRuntimeTypeFactory.getInstance().getClassForType(type); - typeCacheMap.put(feature.getTypeID(), typeClass); - } - else - return false; - } - return typeCacheMap.get(feature.getTypeID()) != null; - } - - /** - * @param typeId - * @return List of <code>AbstractMetaDataEnabledRuntimeTypeExtensions</code> - * for a given by type id - * - * TODO: make more efficient... no need to keep calculating features for subtypes. - */ - public List<IMetaDataEnabledFeatureExtension> getFeatures(String typeId) { - - if (!featuresMap.containsKey(typeId)) - featuresMap.put(typeId,new ArrayList()); - - //copy current featuresMapped to typeId into return list - List<IMetaDataEnabledFeatureExtension> srcList = featuresMap.get(typeId); - List<IMetaDataEnabledFeatureExtension> ret = new ArrayList<IMetaDataEnabledFeatureExtension>(srcList.size()); - copy(ret, srcList); - - List subs = getFeatureExtensionsForMatchingSubclass(typeId); - for (Iterator<IMetaDataEnabledFeatureExtension> it=subs.iterator();it.hasNext();){ - IMetaDataEnabledFeatureExtension featureExt = it.next(); - if (!ret.contains(featureExt)) - ret.add(featureExt); - } - return ret; - - } - - private void copy(List<IMetaDataEnabledFeatureExtension> destList, - List<IMetaDataEnabledFeatureExtension> srcList) { - for (Iterator<IMetaDataEnabledFeatureExtension> it=srcList.iterator();it.hasNext();){ - destList.add(it.next()); - } - } - - /** - * If the feature adapter is mapped to a type which is a superclass of the type of interest, then the feature adapter is an extension of that type - * @param typeId - * @return list of IMetaDataEnabledFeatureExtension - */ - private List<IMetaDataEnabledFeatureExtension> getFeatureExtensionsForMatchingSubclass(String typeId) { - IType type = AttributeValueRuntimeTypeRegistry.getInstance().getType(typeId); - Class typeClass = AttributeValueRuntimeTypeFactory.getInstance().getClassForType(type); - - List<IMetaDataEnabledFeatureExtension> ret = new ArrayList<IMetaDataEnabledFeatureExtension>(); - // loop thru all of the type classes mapped to feature adapters that are subclasses of the type - for (Iterator it=typeCacheMap.keySet().iterator();it.hasNext();){ - String featureTypeId = (String)it.next(); - Class featureTypeClass = typeCacheMap.get(featureTypeId); - try { -// if (featureTypeClass.equals(typeClass)){ -// ret.add(featureTypeClass); -// } -// else - if (typeClass.asSubclass(featureTypeClass) != null) { - ret.addAll(featuresMap.get(featureTypeId)); - } - } catch (ClassCastException e) {// - } - - } - return ret; - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/package-info.java deleted file mode 100644 index 44cf369d7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 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: - * Gerry Kessler/Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Provides tooling support for taglibraries using the Design-time Metadata - * feature (org.eclipse.jst.jsf.common.metadata). - * <p> - * The MetaDataEnabledProcessingFactory singleton instance is the entry point. The tool requests - * the IMetaDataEnabled feature for a particular tag attribute, and through metadata, will locate the - * "metadata processing" feature using the attribute value runtime type system. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.metadataprocessors; |