Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsrinivasan2008-11-05 21:49:36 +0000
committerrsrinivasan2008-11-05 21:49:36 +0000
commitd9f3ec874e20455ecdba99738ff36e075d195545 (patch)
treeaddd2b9b00f22f0fce9cd0918ddef94a8d55c5f8 /jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal
parent2ff89c3276101a20acdcb195ddae03c4ad07a549 (diff)
downloadwebtools.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/internal')
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledType.java50
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeFactory.java126
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AbstractMetaDataEnabledTypeRegistry.java106
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeFactory.java50
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/AttributeValueRuntimeTypeRegistry.java46
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/IMetaDataEnabledFeatureExtension.java32
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureAdapterFactory.java158
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureExtension.java45
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/metadataprocessors/internal/MetaDataEnabledFeatureRegistry.java177
9 files changed, 0 insertions, 790 deletions
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;
- }
-
-
-}

Back to the top