diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata')
105 files changed, 0 insertions, 12673 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Entity.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Entity.java deleted file mode 100644 index 977011abd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Entity.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Entity</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getChildEntities <em>Child Entities</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getTraits <em>Traits</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Entity#getIncludeGroups <em>Include Groups</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity() - * @model extendedMetaData="kind='element' name='entity'" - * @generated - */ -public interface Entity extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Child Entities</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.Entity}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Child Entities</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Child Entities</em>' containment reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_ChildEntities() - * @model type="org.eclipse.jst.jsf.common.metadata.Entity" containment="true" - * extendedMetaData="kind='element' name='entity'" - * @generated - */ - EList getChildEntities(); - - /** - * Returns the value of the '<em><b>Traits</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.Trait}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Traits</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Traits</em>' containment reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_Traits() - * @model type="org.eclipse.jst.jsf.common.metadata.Trait" containment="true" - * extendedMetaData="kind='element' name='trait'" - * @generated - */ - EList getTraits(); - - /** - * Returns the value of the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Id</em>' attribute. - * @see #setId(String) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_Id() - * @model id="true" required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Entity#getId <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Id</em>' attribute. - * @see #getId() - * @generated - */ - void setId(String value); - - /** - * Returns the value of the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Type</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Type</em>' attribute. - * @see #setType(String) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_Type() - * @model - * @generated - */ - String getType(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Entity#getType <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Type</em>' attribute. - * @see #getType() - * @generated - */ - void setType(String value); - - /** - * Returns the value of the '<em><b>Include Groups</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Include Groups</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Include Groups</em>' reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntity_IncludeGroups() - * @model type="org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup" - * extendedMetaData="kind='element' name='include-entity-group'" - * @generated - */ - EList getIncludeGroups(); - - /** - * <!-- begin-user-doc --> - * @param visitor - * <!-- end-user-doc --> - * @model visitorDataType="org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor" - * @generated - */ - void accept(IEntityVisitor visitor); - - /** - * <!-- begin-user-doc --> - * @return Model - * <!-- end-user-doc --> - * @model kind="operation" - * @generated - */ - Model getModel(); - -} // Entity diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/EntityGroup.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/EntityGroup.java deleted file mode 100644 index fd98b48a8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/EntityGroup.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Entity Group</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getEntityGroup() - * @model - * @generated - */ -public interface EntityGroup extends Entity { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - -} // EntityGroup diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/IncludeEntityGroup.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/IncludeEntityGroup.java deleted file mode 100644 index be4f1463f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/IncludeEntityGroup.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Include Entity Group</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri <em>Model Uri</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getIncludeEntityGroup() - * @model - * @generated - */ -public interface IncludeEntityGroup extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Id</em>' attribute. - * @see #setId(String) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getIncludeEntityGroup_Id() - * @model required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getId <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Id</em>' attribute. - * @see #getId() - * @generated - */ - void setId(String value); - - /** - * Returns the value of the '<em><b>Model Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Model Uri</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Model Uri</em>' attribute. - * @see #setModelUri(String) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getIncludeEntityGroup_ModelUri() - * @model extendedMetaData="name='uri'" - * @generated - */ - String getModelUri(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri <em>Model Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Model Uri</em>' attribute. - * @see #getModelUri() - * @generated - */ - void setModelUri(String value); - -} // IncludeEntityGroup diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataFactory.java deleted file mode 100644 index 8b8ea0c04..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * <p><b>NOT API</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage - * @generated - */ -public interface MetadataFactory extends EFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - MetadataFactory eINSTANCE = org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Trait</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Trait</em>'. - * @generated - */ - Trait createTrait(); - - /** - * Returns a new object of class '<em>Include Entity Group</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Include Entity Group</em>'. - * @generated - */ - IncludeEntityGroup createIncludeEntityGroup(); - - /** - * Returns a new object of class '<em>Model</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Model</em>'. - * @generated - */ - Model createModel(); - - /** - * Returns a new object of class '<em>Entity</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Entity</em>'. - * @generated - */ - Entity createEntity(); - - /** - * Returns a new object of class '<em>Entity Group</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Entity Group</em>'. - * @generated - */ - EntityGroup createEntityGroup(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - MetadataPackage getMetadataPackage(); - -} //MetadataFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataPackage.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataPackage.java deleted file mode 100644 index 087f6db19..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/MetadataPackage.java +++ /dev/null @@ -1,871 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <p><b>NOT API</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.MetadataFactory - * @model kind="package" - * @generated - */ -public interface MetadataPackage extends EPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "metadata"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.common.metadata/metadata.ecore"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "md"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - MetadataPackage eINSTANCE = org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl <em>Trait</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getTrait() - * @generated - */ - int TRAIT = 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl <em>Entity</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntity() - * @generated - */ - int ENTITY = 2; - - /** - * The feature id for the '<em><b>Child Entities</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__CHILD_ENTITIES = 0; - - /** - * The feature id for the '<em><b>Traits</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__TRAITS = 1; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__ID = 2; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__TYPE = 3; - - /** - * The feature id for the '<em><b>Include Groups</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY__INCLUDE_GROUPS = 4; - - /** - * The number of structural features of the '<em>Entity</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_FEATURE_COUNT = 5; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl <em>Model</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModel() - * @generated - */ - int MODEL = 0; - - /** - * The feature id for the '<em><b>Child Entities</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__CHILD_ENTITIES = ENTITY__CHILD_ENTITIES; - - /** - * The feature id for the '<em><b>Traits</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__TRAITS = ENTITY__TRAITS; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__ID = ENTITY__ID; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__TYPE = ENTITY__TYPE; - - /** - * The feature id for the '<em><b>Include Groups</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__INCLUDE_GROUPS = ENTITY__INCLUDE_GROUPS; - - /** - * The feature id for the '<em><b>Entity Groups</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__ENTITY_GROUPS = ENTITY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__SOURCE_MODEL_PROVIDER = ENTITY_FEATURE_COUNT + 1; - - /** - * The feature id for the '<em><b>Current Model Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL__CURRENT_MODEL_CONTEXT = ENTITY_FEATURE_COUNT + 2; - - /** - * The number of structural features of the '<em>Model</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int MODEL_FEATURE_COUNT = ENTITY_FEATURE_COUNT + 3; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl <em>Include Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIncludeEntityGroup() - * @generated - */ - int INCLUDE_ENTITY_GROUP = 4; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl <em>Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntityGroup() - * @generated - */ - int ENTITY_GROUP = 1; - - /** - * The feature id for the '<em><b>Child Entities</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__CHILD_ENTITIES = ENTITY__CHILD_ENTITIES; - - /** - * The feature id for the '<em><b>Traits</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__TRAITS = ENTITY__TRAITS; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__ID = ENTITY__ID; - - /** - * The feature id for the '<em><b>Type</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__TYPE = ENTITY__TYPE; - - /** - * The feature id for the '<em><b>Include Groups</b></em>' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP__INCLUDE_GROUPS = ENTITY__INCLUDE_GROUPS; - - /** - * The number of structural features of the '<em>Entity Group</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int ENTITY_GROUP_FEATURE_COUNT = ENTITY_FEATURE_COUNT + 0; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT__ID = 0; - - /** - * The feature id for the '<em><b>Value</b></em>' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT__VALUE = 1; - - /** - * The feature id for the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT__SOURCE_MODEL_PROVIDER = 2; - - /** - * The number of structural features of the '<em>Trait</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int TRAIT_FEATURE_COUNT = 3; - - /** - * The feature id for the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INCLUDE_ENTITY_GROUP__ID = 0; - - /** - * The feature id for the '<em><b>Model Uri</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INCLUDE_ENTITY_GROUP__MODEL_URI = 1; - - /** - * The number of structural features of the '<em>Include Entity Group</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int INCLUDE_ENTITY_GROUP_FEATURE_COUNT = 2; - - /** - * The meta object id for the '<em>ITrait Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getITraitVisitor() - * @generated - */ - int ITRAIT_VISITOR = 5; - - /** - * The meta object id for the '<em>IEntity Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIEntityVisitor() - * @generated - */ - int IENTITY_VISITOR = 6; - - /** - * The meta object id for the '<em>IMeta Data Source Model Provider</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIMetaDataSourceModelProvider() - * @generated - */ - int IMETA_DATA_SOURCE_MODEL_PROVIDER = 7; - - - /** - * The meta object id for the '<em>Model Context</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModelContext() - * @generated - */ - int MODEL_CONTEXT = 8; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.Trait <em>Trait</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Trait</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Trait - * @generated - */ - EClass getTrait(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Trait#getId <em>Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Id</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Trait#getId() - * @see #getTrait() - * @generated - */ - EAttribute getTrait_Id(); - - /** - * Returns the meta object for the containment reference '{@link org.eclipse.jst.jsf.common.metadata.Trait#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference '<em>Value</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Trait#getValue() - * @see #getTrait() - * @generated - */ - EReference getTrait_Value(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider <em>Source Model Provider</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Source Model Provider</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider() - * @see #getTrait() - * @generated - */ - EAttribute getTrait_SourceModelProvider(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup <em>Include Entity Group</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Include Entity Group</em>'. - * @see org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup - * @generated - */ - EClass getIncludeEntityGroup(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getId <em>Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Id</em>'. - * @see org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getId() - * @see #getIncludeEntityGroup() - * @generated - */ - EAttribute getIncludeEntityGroup_Id(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri <em>Model Uri</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Model Uri</em>'. - * @see org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup#getModelUri() - * @see #getIncludeEntityGroup() - * @generated - */ - EAttribute getIncludeEntityGroup_ModelUri(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.Model <em>Model</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Model</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model - * @generated - */ - EClass getModel(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider <em>Source Model Provider</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Source Model Provider</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider() - * @see #getModel() - * @generated - */ - EAttribute getModel_SourceModelProvider(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext <em>Current Model Context</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Current Model Context</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext() - * @see #getModel() - * @generated - */ - EAttribute getModel_CurrentModelContext(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.common.metadata.Model#getEntityGroups <em>Entity Groups</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Entity Groups</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Model#getEntityGroups() - * @see #getModel() - * @generated - */ - EReference getModel_EntityGroups(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.Entity <em>Entity</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Entity</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity - * @generated - */ - EClass getEntity(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.common.metadata.Entity#getChildEntities <em>Child Entities</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Child Entities</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getChildEntities() - * @see #getEntity() - * @generated - */ - EReference getEntity_ChildEntities(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.common.metadata.Entity#getTraits <em>Traits</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Traits</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getTraits() - * @see #getEntity() - * @generated - */ - EReference getEntity_Traits(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Entity#getId <em>Id</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Id</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getId() - * @see #getEntity() - * @generated - */ - EAttribute getEntity_Id(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.Entity#getType <em>Type</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Type</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getType() - * @see #getEntity() - * @generated - */ - EAttribute getEntity_Type(); - - /** - * Returns the meta object for the reference list '{@link org.eclipse.jst.jsf.common.metadata.Entity#getIncludeGroups <em>Include Groups</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the reference list '<em>Include Groups</em>'. - * @see org.eclipse.jst.jsf.common.metadata.Entity#getIncludeGroups() - * @see #getEntity() - * @generated - */ - EReference getEntity_IncludeGroups(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.EntityGroup <em>Entity Group</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Entity Group</em>'. - * @see org.eclipse.jst.jsf.common.metadata.EntityGroup - * @generated - */ - EClass getEntityGroup(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor <em>ITrait Visitor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>ITrait Visitor</em>'. - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor" serializable="false" - * @generated - */ - EDataType getITraitVisitor(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor <em>IEntity Visitor</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>IEntity Visitor</em>'. - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor" serializable="false" - * @generated - */ - EDataType getIEntityVisitor(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider <em>IMeta Data Source Model Provider</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>IMeta Data Source Model Provider</em>'. - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider" - * @generated - */ - EDataType getIMetaDataSourceModelProvider(); - - /** - * Returns the meta object for data type '{@link org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor <em>Model Context</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for data type '<em>Model Context</em>'. - * @see org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor - * @model instanceClass="org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor" - * @generated - */ - EDataType getModelContext(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - MetadataFactory getMetadataFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("hiding") - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl <em>Trait</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.TraitImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getTrait() - * @generated - */ - EClass TRAIT = eINSTANCE.getTrait(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TRAIT__ID = eINSTANCE.getTrait_Id(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' containment reference feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference TRAIT__VALUE = eINSTANCE.getTrait_Value(); - - /** - * The meta object literal for the '<em><b>Source Model Provider</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute TRAIT__SOURCE_MODEL_PROVIDER = eINSTANCE.getTrait_SourceModelProvider(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl <em>Include Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIncludeEntityGroup() - * @generated - */ - EClass INCLUDE_ENTITY_GROUP = eINSTANCE.getIncludeEntityGroup(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute INCLUDE_ENTITY_GROUP__ID = eINSTANCE.getIncludeEntityGroup_Id(); - - /** - * The meta object literal for the '<em><b>Model Uri</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute INCLUDE_ENTITY_GROUP__MODEL_URI = eINSTANCE.getIncludeEntityGroup_ModelUri(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl <em>Model</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModel() - * @generated - */ - EClass MODEL = eINSTANCE.getModel(); - - /** - * The meta object literal for the '<em><b>Source Model Provider</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute MODEL__SOURCE_MODEL_PROVIDER = eINSTANCE.getModel_SourceModelProvider(); - - /** - * The meta object literal for the '<em><b>Current Model Context</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute MODEL__CURRENT_MODEL_CONTEXT = eINSTANCE.getModel_CurrentModelContext(); - - /** - * The meta object literal for the '<em><b>Entity Groups</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference MODEL__ENTITY_GROUPS = eINSTANCE.getModel_EntityGroups(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl <em>Entity</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntity() - * @generated - */ - EClass ENTITY = eINSTANCE.getEntity(); - - /** - * The meta object literal for the '<em><b>Child Entities</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ENTITY__CHILD_ENTITIES = eINSTANCE.getEntity_ChildEntities(); - - /** - * The meta object literal for the '<em><b>Traits</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ENTITY__TRAITS = eINSTANCE.getEntity_Traits(); - - /** - * The meta object literal for the '<em><b>Id</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ENTITY__ID = eINSTANCE.getEntity_Id(); - - /** - * The meta object literal for the '<em><b>Type</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute ENTITY__TYPE = eINSTANCE.getEntity_Type(); - - /** - * The meta object literal for the '<em><b>Include Groups</b></em>' reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference ENTITY__INCLUDE_GROUPS = eINSTANCE.getEntity_IncludeGroups(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl <em>Entity Group</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.EntityGroupImpl - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getEntityGroup() - * @generated - */ - EClass ENTITY_GROUP = eINSTANCE.getEntityGroup(); - - /** - * The meta object literal for the '<em>ITrait Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getITraitVisitor() - * @generated - */ - EDataType ITRAIT_VISITOR = eINSTANCE.getITraitVisitor(); - - /** - * The meta object literal for the '<em>IEntity Visitor</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIEntityVisitor() - * @generated - */ - EDataType IENTITY_VISITOR = eINSTANCE.getIEntityVisitor(); - - /** - * The meta object literal for the '<em>IMeta Data Source Model Provider</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getIMetaDataSourceModelProvider() - * @generated - */ - EDataType IMETA_DATA_SOURCE_MODEL_PROVIDER = eINSTANCE.getIMetaDataSourceModelProvider(); - - /** - * The meta object literal for the '<em>Model Context</em>' data type. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor - * @see org.eclipse.jst.jsf.common.metadata.internal.impl.MetadataPackageImpl#getModelContext() - * @generated - */ - EDataType MODEL_CONTEXT = eINSTANCE.getModelContext(); - - } - -} //MetadataPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Model.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Model.java deleted file mode 100644 index ed4603fad..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Model.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Model</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Model#getEntityGroups <em>Entity Groups</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider <em>Source Model Provider</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext <em>Current Model Context</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel() - * @model extendedMetaData="kind='element' name='metadatamodel'" - * @generated - */ -public interface Model extends Entity { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source Model Provider</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Source Model Provider</em>' attribute. - * @see #setSourceModelProvider(IMetaDataSourceModelProvider) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel_SourceModelProvider() - * @model unique="false" dataType="org.eclipse.jst.jsf.common.metadata.IMetaDataSourceModelProvider" transient="true" volatile="true" - * @generated - */ - IMetaDataSourceModelProvider getSourceModelProvider(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Model#getSourceModelProvider <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source Model Provider</em>' attribute. - * @see #getSourceModelProvider() - * @generated - */ - void setSourceModelProvider(IMetaDataSourceModelProvider value); - - /** - * Returns the value of the '<em><b>Current Model Context</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Current Model Context</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Current Model Context</em>' attribute. - * @see #setCurrentModelContext(ModelKeyDescriptor) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel_CurrentModelContext() - * @model dataType="org.eclipse.jst.jsf.common.metadata.ModelContext" transient="true" volatile="true" - * @generated - */ - ModelKeyDescriptor getCurrentModelContext(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Model#getCurrentModelContext <em>Current Model Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Current Model Context</em>' attribute. - * @see #getCurrentModelContext() - * @generated - */ - void setCurrentModelContext(ModelKeyDescriptor value); - - /** - * Returns the value of the '<em><b>Entity Groups</b></em>' reference list. - * The list contents are of type {@link org.eclipse.jst.jsf.common.metadata.EntityGroup}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Entity Groups</em>' reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Entity Groups</em>' reference list. - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getModel_EntityGroups() - * @model type="org.eclipse.jst.jsf.common.metadata.EntityGroup" - * extendedMetaData="kind='element' name='entityGroup'" - * @generated - */ - EList getEntityGroups(); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param groupId - * @return EntityGroup - * @model - * @generated - */ - EntityGroup findIncludeGroup(String groupId); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @model visitorDataType="org.eclipse.jst.jsf.common.metadata.IEntityVisitor" - * @generated - */ - void accept(IEntityVisitor visitor); - -} // Model diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Trait.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Trait.java deleted file mode 100644 index 4eb1b30c7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/Trait.java +++ /dev/null @@ -1,129 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Trait</b></em>'. - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Trait#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Trait#getValue <em>Value</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider <em>Source Model Provider</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getTrait() - * @model extendedMetaData="kind='element' name='trait'" - * @generated - */ -public interface Trait extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Id</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Id</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Id</em>' attribute. - * @see #setId(String) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getTrait_Id() - * @model id="true" required="true" - * @generated - */ - String getId(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Trait#getId <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Id</em>' attribute. - * @see #getId() - * @generated - */ - void setId(String value); - - /** - * Returns the value of the '<em><b>Value</b></em>' containment reference. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' reference isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' containment reference. - * @see #setValue(EObject) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getTrait_Value() - * @model containment="true" required="true" - * extendedMetaData="kind='element' namespace='##targetNamespace'" - * @generated - */ - EObject getValue(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Trait#getValue <em>Value</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' containment reference. - * @see #getValue() - * @generated - */ - void setValue(EObject value); - - /** - * Returns the value of the '<em><b>Source Model Provider</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source Model Provider</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Source Model Provider</em>' attribute. - * @see #setSourceModelProvider(IMetaDataSourceModelProvider) - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#getTrait_SourceModelProvider() - * @model dataType="org.eclipse.jst.jsf.common.metadata.IMetaDataSourceModelProvider" - * @generated - */ - IMetaDataSourceModelProvider getSourceModelProvider(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.Trait#getSourceModelProvider <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Source Model Provider</em>' attribute. - * @see #getSourceModelProvider() - * @generated - */ - void setSourceModelProvider(IMetaDataSourceModelProvider value); - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param visitor - * @model visitorDataType="org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor" - * annotation="http://www.eclipse.org/emf/2002/GenModel body='visitor.visit(this);'" - * @generated - */ - void accept(ITraitVisitor visitor); - -} // Trait diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataLocator.java deleted file mode 100644 index 8719c1891..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractMetaDataLocator.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.HashSet; -import java.util.Set; - -/** - * Convenient abstract class that a source model locator should consider extending. - */ -public abstract class AbstractMetaDataLocator implements IMetaDataLocator, IMetaDataObservable{ - - private IDomainSourceModelType domainSourceModelType; - private Set/*<IMetaDataObserver>*/ observers; - - /** - * Constructor - */ - public AbstractMetaDataLocator(){ - observers = new HashSet(1); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#getDomainSourceModelType() - */ - public IDomainSourceModelType getDomainSourceModelType() { - return domainSourceModelType; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#setDomainSourceModelType(org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType) - */ - public void setDomainSourceModelType( - IDomainSourceModelType domainSourceModelType) { - this.domainSourceModelType = domainSourceModelType; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#addObserver(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataObserver) - */ - public void addObserver(IMetaDataObserver observer) { - observers.add(observer); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#removeObserver(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataObserver) - */ - public void removeObserver(IMetaDataObserver observer) { - observers.remove(observer); - } - - /** - * @return the set of {@link IMetaDataObserver}s for this instance - */ - public Set/*<IMetaDataObserver>*/ getObservers(){ - return observers; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractTagLibDomainContentModelMetaDataTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractTagLibDomainContentModelMetaDataTranslator.java deleted file mode 100644 index c9a297247..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/AbstractTagLibDomainContentModelMetaDataTranslator.java +++ /dev/null @@ -1,360 +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.common.metadata.internal; - -import java.util.Iterator; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.MetadataFactory; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesFactory; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; - -/** - * Abstract class that the taglib domain translators use to - * convert the CM model to a standard meta data model - * - */ -public abstract class AbstractTagLibDomainContentModelMetaDataTranslator { - - /** - * {@link IMetaDataModelMergeAssistant} to use - */ - protected IMetaDataModelMergeAssistant _assistant; - - /** - * Set the assistant to use during the translation. Must be called prior to doTransalate(doc); - * @param assistant - */ - protected void setAssistant(IMetaDataModelMergeAssistant assistant){ - _assistant = assistant; - } - - /** - * Transforms the CMDocument into entities and traits of a standard metadata model - * using the assistant that must be set before this call. - * @param doc - */ - protected void doTranslate(CMDocument doc){ - createTags(doc); - createTagfileTraits(doc); - } - - /** - * @param entity - * @param key - * @param value - */ - protected void createSimpleStringEntityTraitIfNecessary(final Entity entity, final String key, - final String value) { - Trait t = findTraitOnEntityById(entity, key); - if (t == null){ - t = internalCreateTrait(entity, key); - - StringValue val = TraitTypesFactory.eINSTANCE.createStringValue(); - val.setValue(value); - - t.setValue(val); - } - } - - /** - * @param entity - * @param key - * @param value - */ - protected void createSimpleBooleanObjectEntityTraitIfNecessary(final Entity entity, - String key, boolean value) { - - Trait t = findTraitOnEntityById(entity, key); - if (t == null){ - t = internalCreateTrait(entity, key); - - BooleanValue val = TraitTypesFactory.eINSTANCE.createBooleanValue(); - val.setTrue(value); - - t.setValue(val); - } - - } - - /** - * @param entity - * @param key - * @return Trait - */ - protected Trait internalCreateTrait(final Entity entity, final String key) { - Trait t = MetadataFactory.eINSTANCE.createTrait(); - t.setId(key); - t.setSourceModelProvider(_assistant.getSourceModelProvider()); - entity.getTraits().add(t); - return t; - } - - /** - * @param entity - * @param key - * @return Trait - */ - protected Trait findTraitOnEntityById(final Entity entity, final String key) { - for (Iterator it=entity.getTraits().iterator();it.hasNext();){ - Trait t = (Trait)it.next(); - if (key.equals(t.getId())) - return t; - } - return null; - } - - /** - * @param nodeName - * @return Entity - */ - protected Entity findTagEntity(final String nodeName) { - for (Iterator it=getMergedModel().getChildEntities().iterator();it.hasNext();){ - Entity entity = (Entity)it.next(); - if (nodeName.equals(entity.getId())) - return entity; - } - return null; - } - - /** - * @param tag - * @param attributeName - * @return Attribute entity for supplied attribute name and given Tag entity. Will return null if not found. - */ - protected Entity findAttributeEntityForTagEntity(final Entity tag, final String attributeName) { - for (Iterator it=tag.getChildEntities().iterator();it.hasNext();){ - Entity attr = (Entity)it.next(); - if (attributeName.equals(attr.getId())) - return attr; - } - return null; - } - /** - * Create entities for tags - * @param doc - */ - protected void createTags(final CMDocument doc) { - for (Iterator it=doc.getElements().iterator();it.hasNext();){ - CMElementDeclaration tag = (CMElementDeclaration)it.next(); - Entity entity = findTagEntity(tag.getNodeName()); - if (entity == null){ - entity = MetadataFactory.eINSTANCE.createEntity(); - entity.setId(getTagNodeName(tag)); - entity.setType("tag"); //$NON-NLS-1$ - getMergedModel().getChildEntities().add(entity); - } - setTagEntityTraits(tag, entity); - } - - } - - /** - * @param tag - * @return tag node name - */ - protected String getTagNodeName(CMElementDeclaration tag) { - return tag.getNodeName(); - } - - /** - * Sets the standard traits for a tag entity from the element declaration - * @param tag - * @param entity - */ - protected void setTagEntityTraits(CMElementDeclaration tag, Entity entity) { - createSimpleStringEntityTraitIfNecessary(entity, "display-label", getTagDisplayName(tag)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(entity, "description", getTagDescription(tag)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(entity, "small-icon", getTagSmallIcon(tag)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(entity, "large-icon", getTagLargeIcon(tag)); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(entity, "expert", getTagIsExpert(tag)); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(entity, "hidden", getTagIsHidden(tag)); //$NON-NLS-1$ - - createAttributeEntities(entity, tag); - } - - /** - * @param tagEntity - * @param tag - */ - protected void createAttributeEntities(Entity tagEntity, - CMElementDeclaration tag) { - - for (Iterator it=tag.getAttributes().iterator();it.hasNext();){ - CMAttributeDeclaration cmAttr = (CMAttributeDeclaration)it.next(); - Entity attr = findAttributeEntityForTagEntity(tagEntity, cmAttr.getAttrName()); - if (attr == null) { - attr = MetadataFactory.eINSTANCE.createEntity(); - attr.setId(cmAttr.getAttrName()); - tagEntity.getChildEntities().add(attr); - } - createAttributeTraits(attr, cmAttr); - } - - - } - - /** - * @param attr - * @param cmAttr - */ - protected void createAttributeTraits(Entity attr, - CMAttributeDeclaration cmAttr) { - - createSimpleStringEntityTraitIfNecessary(attr, "description", getTagAttributeDescription(cmAttr)); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(attr, "required", getTagAttributeIsRequired(cmAttr)); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(attr, "default-value", getTagAttributeDefaultValue(cmAttr)); //$NON-NLS-1$ - } - - /** - * @param cmAttr - * @return null. subclass should override if CMAttributeDeclaration has the metadata. - */ - protected String getTagAttributeDescription(CMAttributeDeclaration cmAttr) {return null;} - - /** - * @param cmAttr - * @return false. subclass should override if CMAttributeDeclaration has the metadata. - */ - protected boolean getTagAttributeIsRequired(CMAttributeDeclaration cmAttr) {return cmAttr.getUsage() == CMAttributeDeclaration.REQUIRED;} - - /** - * @param cmAttr - * @return null. subclass should override if CMAttributeDeclaration has the metadata. - */ - protected String getTagAttributeDefaultValue(CMAttributeDeclaration cmAttr) {return null;} - - /** - * @param tag - * @return false. subclass should override if CMElementDeclaration has the metadata. - */ - protected boolean getTagIsHidden(CMElementDeclaration tag) {return false;} - - /** - * @param tag - * @return false. subclass should override if CMElementDeclaration has the metadata. - */ - protected boolean getTagIsExpert(CMElementDeclaration tag) {return false;} - - /** - * @param tag - * @return null. subclass should override if CMElementDeclaration has the metadata. - */ - protected String getTagLargeIcon(CMElementDeclaration tag) {return null;} - - /** - * @param tag - * @return null. subclass should override if CMElementDeclaration has the metadata. - */ - protected String getTagSmallIcon(CMElementDeclaration tag) {return null;} - - /** - * @param tag - * @return null. subclass should override if CMElementDeclaration has the metadata. - */ - protected String getTagDescription(CMElementDeclaration tag) {return null;} - - /** - * @param tag - * @return tag.getElementName() - */ - protected String getTagDisplayName(CMElementDeclaration tag) {return tag.getElementName();} - - /** - * Creates standard traits for tag file entity from CMDocument metadata - * @param doc - */ - protected void createTagfileTraits(CMDocument doc) { - Model model = getMergedModel(); - - createSimpleStringEntityTraitIfNecessary(model, "display-label", getURIDisplayLabel()); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(model, "description", getURIDescription()); //$NON-NLS-1$ - createSimpleStringEntityTraitIfNecessary(model, "default-prefix", getURIDefaultPrefix()); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(model, "expert", getURIExpert()); //$NON-NLS-1$ - createSimpleBooleanObjectEntityTraitIfNecessary(model, "hidden", getURIHidden()); //$NON-NLS-1$ - - } - - /** - * @return the display label to use for this model. Subclasses should override if model has the meta data. - */ - protected String getURIDisplayLabel(){ - return getMergedModel().getId(); - } - - /** - * @return default prefix to use for tags. Returns null. Subclasses should override if model has the meta data. - */ - protected String getURIDefaultPrefix(){ - return null; - } - - /** - * @return description to use. Default is the URI. Subclasses should override if model has the meta data. - */ - protected String getURIDescription(){ - return getMergedModel().getId(); - } - - /** - * @return false. Subclasses should override if model has the meta data. - */ - protected boolean getURIExpert() { return false;} - - /** - * @return false. Subclasses should override if model has the meta data. - */ - protected boolean getURIHidden() {return false; } - - /** - * @return a model of all entities and traits - */ - protected Model getMergedModel() { - Model model = (Model)_assistant.getMergedModel().getRoot(); - if (model == null){ - //need to create model key object - Model tld = createTLDModel(); - _assistant.getMergedModel().setRoot(tld); - model = (Model)_assistant.getMergedModel().getRoot(); - } - return model; - } - - /** - * @return new model - */ - protected Model createTLDModel() { - Model entity = getFactory().createModel(); - entity.setId(_assistant.getMergedModel().getModelKey().getUri()); - return entity; - } - - /** - * @return MetadataFactory instance - */ - protected MetadataFactory getFactory(){ - return (MetadataFactory) MetadataPackage.eINSTANCE.getEFactoryInstance(); - } - - /** - * @return CMDocument being used for the current translate call - */ - protected CMDocument getSourceModel() { - return (CMDocument)_assistant.getSourceModelProvider().getSourceModel(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategy.java deleted file mode 100644 index 01a38e61b..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategy.java +++ /dev/null @@ -1,193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Default class used for loading metadata. - * Loads the source types from extensions defined against the domain. - * - * see org.eclipse.jst.jsf.common.domainLoadingStrategies ext-pt - */ -public class DomainLoadingStrategy implements IDomainLoadingStrategy, IMetaDataObserver { - - /** - * Domain id - */ - protected String domain; - - private MetaDataModel _model; - private List /*<IDomainSourceModelType>*/ _sourceTypes; - private List /*<IMetaDataSourceModelProvider>*/ _sources; - - /** - * Constructor - * @param domain - */ - public DomainLoadingStrategy(String domain){ - this.domain = domain; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainLoadingStrategy#load(org.eclipse.jst.jsf.common.metadata.internal.MetaDataModel) - */ - public void load(MetaDataModel model) { - this._model = model; - _sourceTypes = loadDomainSourceModelTypes(); - sortSourceTypes(_sourceTypes); - _sources = locateMetaDataSourceInstances(_sourceTypes, model); - mergeModel(model, _sources); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainLoadingStrategy#reload() - */ - public void reload() throws ModelNotSetException { - //System.out.println("reload");//debug //$NON-NLS-1$ - if (_model == null) - throw new ModelNotSetException(); - - removeOldLocatorObservers(); - _sources = locateMetaDataSourceInstances(_sourceTypes, _model); - mergeModel(_model, _sources); - } - - /** - * Responsible for iterating through the sorted list of <code>IMetaDataSourceModelProvider</code> - * and merging the models after first translating the source model as required, into a single mreged model of - * standard metadata Entities and Traits. - * @param model - * @param sources - */ - protected void mergeModel(MetaDataModel model, List/*<IMetaDataSourceModelProvider>*/ sources) { - - StandardModelFactory.debug(">> Begin Merge: "+model.getModelKey()+"("+sources.size()+ " sources)", StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - IMetaDataModelMergeAssistant assistant = createModelMergeAssistant(model); - for (Iterator/*<IMetaDataSourceModelProvider>*/ it = sources.iterator();it.hasNext();){ - IMetaDataSourceModelProvider mds = (IMetaDataSourceModelProvider)it.next(); - Iterator translators = mds.getLocator().getDomainSourceModelType().getTranslators().iterator(); - while (translators.hasNext()){ - IMetaDataTranslator translator = (IMetaDataTranslator)translators.next(); - if (translator.canTranslate(mds)){ - StandardModelFactory.debug(">>> Merging: "+model.getModelKey()+"::"+mds, StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$//$NON-NLS-2$ - assistant.setSourceModelProvider(mds); - try { - translator.translate(assistant); - } catch (Exception e) { - StandardModelFactory.debug(">>>> Error during translate/merge of: "+model.getModelKey()+": "+mds, StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ //$NON-NLS-2$ - JSFCommonPlugin.log(IStatus.ERROR, "Error during load of: "+mds, e); //$NON-NLS-1$ - } - } - } - } - assistant.setMergeComplete(); - StandardModelFactory.debug(">> End Merge: "+model.getModelKey(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - } - - /** - * @param model - * @return an instance of a IMetaDataModelMergeAssistant to be used while merging source models - */ - protected IMetaDataModelMergeAssistant createModelMergeAssistant(MetaDataModel model){ - return new MetaDataModelMergeAssistantImpl(model); - } - - /** - * Allows for subclasses to override the default mechanism for sorting the source types. - * @param sourceTypes - */ - protected void sortSourceTypes(List/*<IDomainSourceModelType>*/ sourceTypes) { - //allows override - } - - /** - * @return list of <code>IDomainSourceModelType</code>s located in the <code>DomainSourceTypesRegistry</code> - * for the specified uri - */ - protected List/*<IDomainSourceModelType>*/ loadDomainSourceModelTypes() { - return DomainSourceTypesRegistry.getInstance().getDomainSourceTypes(domain); - } - - /** - * @param sourceTypes - * @param model - * @return list of <code>IMetaDataSourceModelProvider</code> instances from the domain source types applicable for - * this domain for this particular uri specified in the model - */ - protected List/*<IMetaDataSourceModelProvider>*/ locateMetaDataSourceInstances(List/*<IDomainSourceModelType>*/ sourceTypes, MetaDataModel model) { - List/*<IMetaDataSourceModelProvider>*/ sources = new ArrayList/*<IMetaDataSourceModelProvider>*/(); - for (Iterator/*<IDomainSourceModelType>*/ it = sourceTypes.iterator();it.hasNext();){ - IDomainSourceModelType sourceType = (IDomainSourceModelType)it.next(); - IMetaDataLocator locator = sourceType.getLocator(model.getModelKey().getProject()); - if (locator != null) { - //We MUST set the sourceType here to associate the handler with locator to use for the source models - locator.setDomainSourceModelType(sourceType); - - List/*<IMetaDataSourceModelProvider>*/ providers = locator.locateMetaDataModelProviders(model.getModelKey().getUri()); - if (providers != null && !providers.isEmpty()){ - for (Iterator mdProviders =providers.iterator();mdProviders.hasNext();){ - IMetaDataSourceModelProvider provider = (IMetaDataSourceModelProvider)mdProviders.next(); - //We MUST set the sourceType here to associate the translators to use for the source models - provider.setLocator(locator); - sources.add(provider); - } - } - //listen for changes - locator.addObserver(this); - } - } - return sources; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataObserver#notifyMetadataChanged(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent) - */ - public void notifyMetadataChanged(IMetaDataChangeNotificationEvent event) { - //for now, if any event occurs, we need to flush the _model so that it will rebuild - _model.setNeedsRefresh(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainLoadingStrategy#cleanup() - */ - public void cleanup(){ - removeOldLocatorObservers(); - _sources = null; - _sourceTypes = null; - _model = null; - } - - private void removeOldLocatorObservers(){ - if (_sources != null){ - for (Iterator it= _sources.iterator();it.hasNext();){ - IMetaDataSourceModelProvider provider = (IMetaDataSourceModelProvider)it.next(); - if (provider != null) { - IMetaDataLocator locator = provider.getLocator(); - if (locator != null){ - locator.removeObserver(this); - locator.setDomainSourceModelType(null); - provider.setLocator(null); - } - } - } - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategyRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategyRegistry.java deleted file mode 100644 index 19b603d02..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainLoadingStrategyRegistry.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - - -/** - * Registry of strategies used to load domains of metadata. - * Uses the <code>org.eclipse.jst.jsf.common.domainLoadingStrategies</code> ext-pt to load. - * - * see <code>org.eclipse.jst.jsf.common.domainLoadingStrategies</code> ext-pt - */ -public class DomainLoadingStrategyRegistry{ - private static DomainLoadingStrategyRegistry INSTANCE; - - private HashMap/*<String, DomainLoadingStrategyDescriptorImpl>*/ domainLoadingStrategyDescriptors; - -// public static final String TAGLIB_DOMAIN ="TagLibraryDomain"; //this does *not* belong here. FIX ME -// public static final String TAGLIB_DOMAIN_SOURCE_HANDLER_ID = TAGLIB_DOMAIN + "SourceHandler"; -// public static final String TAGLIB_DOMAIN_TRANSLATOR = "com.foo.translators."+TAGLIB_DOMAIN + "Translator"; - - private static final String EXTENSION_POINT_ID = "domainLoadingStrategies"; //$NON-NLS-1$ - - private DomainLoadingStrategyRegistry(){ - init(); - } - - /** - * @return singleton instance of the DomainLoadingStrategyRegistry - */ - public synchronized static DomainLoadingStrategyRegistry getInstance() { - if (INSTANCE == null){ - INSTANCE = new DomainLoadingStrategyRegistry(); - } - return INSTANCE; - } - - /** - * Loads registry with descriptors from the domainLoadingStrategies ext-pt. - */ - synchronized final void init(){ - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, EXTENSION_POINT_ID ); - if (point != null) { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - DomainLoadingStrategyDescriptorImpl dls = new DomainLoadingStrategyDescriptorImpl(element); - addDomainLoadingStrategyDescriptor(dls); - } - } - } - - /** - * Add domain loading strategy descriptor for a domain to the registry domains - * @param strategy - */ - protected void addDomainLoadingStrategyDescriptor(DomainLoadingStrategyDescriptorImpl strategy){ - getDescriptors().put(strategy.getDomain(), strategy); - } - - /** - * @param domain - * @return an instance of an <code>IDomainLoadingStrategy</code> for the given domain - */ - public IDomainLoadingStrategy getLoadingStrategy(String domain){ - DomainLoadingStrategyDescriptorImpl strategy = (DomainLoadingStrategyDescriptorImpl)getDescriptors().get(domain); - if (strategy == null){ - return createDefaultLoadingStrategy(); - } - return createLoadingStrategy(domain); - } - - - /** - * @return strategy that will only use standard metadata files - */ - private IDomainLoadingStrategy createDefaultLoadingStrategy() { - return new DomainLoadingStrategy(null); - } - - private IDomainLoadingStrategy createLoadingStrategy(String domain){ - return ((DomainLoadingStrategyDescriptorImpl)getDescriptors().get(domain)).newInstance(); - } - - private Map/*<String, DomainLoadingStrategyDescriptorImpl>*/ getDescriptors(){ - if (domainLoadingStrategyDescriptors == null){ - domainLoadingStrategyDescriptors = new HashMap/*<String, DomainLoadingStrategyDescriptorImpl>*/(); - } - return domainLoadingStrategyDescriptors; - } - - /** - * Implementation of a DomainLoadingStrategy descriptor that is responsible for creating instances of the IDomainLoadingStrategy - */ - private static class DomainLoadingStrategyDescriptorImpl { - String domain; - String loadingStrategyClassName; - String bundleId; - Class strategy; - IConfigurationElement element; - - DomainLoadingStrategyDescriptorImpl(IConfigurationElement element){ - this.element = element; - this.init(); - } - - private void init() { - domain = element.getAttribute("domainId"); //$NON-NLS-1$ - bundleId = element.getContributor().getName(); - loadingStrategyClassName = element.getAttribute("domainLoadingStrategy"); //$NON-NLS-1$ - } - - /** - * @return domain id - */ - public String getDomain() { - return domain; - } - - /** - * @return new instance of IDomainLoadingStrategy - */ - public IDomainLoadingStrategy newInstance(){ - try { - Class[] parameterTypes = new Class[]{String.class}; - Object[] initargs = new Object[]{domain}; - Object loader = this.getLoadingStrategy().getConstructor(parameterTypes).newInstance(initargs); - if (loader instanceof IDomainLoadingStrategy) - return (IDomainLoadingStrategy)loader; - } catch (InstantiationException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Unable to instantiate IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalAccessException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (IllegalArgumentException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalArgumentException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (SecurityException e) { - JSFCommonPlugin.log(IStatus.ERROR, "SecurityException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (InvocationTargetException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InvocationTargetException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } catch (NoSuchMethodException e) { - JSFCommonPlugin.log(IStatus.ERROR, "NoSuchMethodException during creation of IDomainLoadingStrategy for: "+ domain,e); //$NON-NLS-1$ - } - return null; - } - - private Class getLoadingStrategy() { - if (strategy == null){ - strategy = JSFCommonPlugin.loadClass(loadingStrategyClassName, bundleId); - } - return strategy; - } - - } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceModelTypeDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceModelTypeDescriptor.java deleted file mode 100644 index dd623ca5d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceModelTypeDescriptor.java +++ /dev/null @@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Implementation of a {@link IDomainSourceModelType} descriptor. - * Responsible for producing instances of {@link IDomainSourceModelType}. - * Also responsible for creating the {@link IMetaDataTranslator} descriptors from the - * <code>com.eclipse.jst.jsf.common.domainSourceModelTypeTranslators</code> ext-pt - */ -public class DomainSourceModelTypeDescriptor { - private static final String TRANSLATORS_EXTENSION_POINT_ID = "domainSourceModelTypeTranslators"; //$NON-NLS-1$ - private static final String STANDARD_FILE_NULL_TRANSLATOR = "org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataFilesTranslator"; //$NON-NLS-1$ - private String domain = "DEFAULT"; //$NON-NLS-1$ - private String domainSourceModelTypeId; - private String locatorClassName = "org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataLocator"; //$NON-NLS-1$ - private Set translatorDescriptors; - private String bundleId = JSFCommonPlugin.PLUGIN_ID; - private int ordinal; - - /** - * Constructor - * @param domain - * @param domainSourceModelTypeId - * @param locatorClassName - * @param bundleId - * @param ordinal - */ - public DomainSourceModelTypeDescriptor(String domain, String domainSourceModelTypeId, String locatorClassName, String bundleId, int ordinal){ - this.domain = domain; - this.locatorClassName = locatorClassName; - this.domainSourceModelTypeId = domainSourceModelTypeId; - this.bundleId = bundleId; - this.ordinal = ordinal; - init(); - } - - /** - * Default model type descriptor that will load only standard metadata files - */ - public DomainSourceModelTypeDescriptor(){ -// getTranslatorDescriptors(); - //createTranslatorInstances() will add the standard null translator - } - - private synchronized void init() { - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, TRANSLATORS_EXTENSION_POINT_ID ); - if (point != null) { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - String srcHdlrId = element.getAttribute("domainSourceModelTypeId"); //$NON-NLS-1$ - if (srcHdlrId.equals(domainSourceModelTypeId)) - addTranslatorDescriptor(element); - } - } - } - - private void addTranslatorDescriptor(IConfigurationElement element) { - String translator = element.getAttribute("translatorClass"); //$NON-NLS-1$ - DomainSourceModelTranslatorDescriptor d = new DomainSourceModelTranslatorDescriptor(translator, element.getContributor().getName()); - getTranslatorDescriptors().add(d); - } - - private Set getTranslatorDescriptors(){ - if (translatorDescriptors == null){ - translatorDescriptors = new HashSet(); - } - return translatorDescriptors; - } - - /** - * @return domain - */ - public String getDomain() { - return domain; - } - - /** - * @return new instance of the {@link IDomainSourceModelType} - */ - public IDomainSourceModelType getInstance(){ - return new DomainSourceModelTypeImpl(); - } - - /** - * Internal class implementing {@link IDomainSourceModelType} - */ - class DomainSourceModelTypeImpl implements IDomainSourceModelType{ - - private Set translators; - private IMetaDataLocator locator; - - DomainSourceModelTypeImpl(){ - // restrict construction to package scope - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType#getDomain() - */ - public String getDomain() { - return domain; - } - - /** - * @return value of ordinal defined by the ext-pt used for ordering source types for a domain - */ - public int getOrdinal(){ - return ordinal; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType#getLocator() - */ - public IMetaDataLocator getLocator(IProject project) { - if (locator == null){ - locator = MetaDataLocatorFactory.getInstance().getLocator(locatorClassName, bundleId, project); - } - - return locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IDomainSourceModelType#getTranslators() - */ - public Set getTranslators() { - if (translators == null){ - translators = createTranslatorInstances(); - } - return translators; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString(){ - StringBuffer buf = new StringBuffer("DomainSourceModelTypeImpl"); //$NON-NLS-1$ - buf.append("(domain = "); //$NON-NLS-1$ - buf.append(getDomain()); - buf.append(", locator = "); //$NON-NLS-1$ - buf.append(locator != null ? locator.toString() : "null"); //$NON-NLS-1$ - buf.append(")"); //$NON-NLS-1$ - return buf.toString(); - } - - private Set createTranslatorInstances() { - translators = new HashSet/*<IMetaDataTranslator>*/(); - if (getTranslatorDescriptors().size() == 0){// for TagLibDomain, we are adding null translator via extension (as of 7/16/07) - //would get here if a domain and source type was defined without a domain translator. Should not happen, but - //add Null Translator for now.... - //we could/should raise exception. - //Developers should add a STANDARD_FILE_NULL_TRANSLATOR if using standard metadata format. - Class klass = JSFCommonPlugin.loadClass(STANDARD_FILE_NULL_TRANSLATOR, JSFCommonPlugin.PLUGIN_ID); - try { - translators.add(klass.newInstance()); - return translators; - } catch (InstantiationException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances(STANDARD_FILE_NULL_TRANSLATOR)"); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances(STANDARD_FILE_NULL_TRANSLATOR)"); //$NON-NLS-1$ - } - - } - - Iterator/*<DomainSourceModelTranslatorDescriptor>*/it = getTranslatorDescriptors().iterator(); - while (it.hasNext()){ - DomainSourceModelTranslatorDescriptor d = (DomainSourceModelTranslatorDescriptor)it.next(); - Class klass = JSFCommonPlugin.loadClass(d.getTranslator(), d.getBundleId()); - try { - translators.add(klass.newInstance()); - } catch (InstantiationException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances"); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - // TODO: other error handling? - JSFCommonPlugin.log(e, "Error in createTranslatorInstances"); //$NON-NLS-1$ - } - } - return translators; - } - - } - - /** - * Internal class implementing a descriptor for DomainSourceModelTranslators - */ - static class DomainSourceModelTranslatorDescriptor { - - private String _translator; - private String _bundleId; - - /** - * Constructor - * @param translator - * @param bundleId - */ - public DomainSourceModelTranslatorDescriptor(String translator, String bundleId) { - this._translator = translator; - this._bundleId = bundleId; - } - - String getTranslator(){ - return _translator; - } - - String getBundleId(){ - return _bundleId; - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceTypesRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceTypesRegistry.java deleted file mode 100644 index 000fdef91..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/DomainSourceTypesRegistry.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.internal.DomainSourceModelTypeDescriptor.DomainSourceModelTypeImpl; - -/** - * Registry of Domain Source Types loaded from domainSourceModelTypes ext-pt. - */ -public class DomainSourceTypesRegistry{ - private static final String EXTENSION_POINT_ID = "domainSourceModelTypes"; //$NON-NLS-1$ - private static DomainSourceTypesRegistry INSTANCE; - private Map/*<String, List/*<DomainSourceModelTypeDescriptor>>*/ domainSourceTypeDescriptors; - - private DomainSourceTypesRegistry(){ - init(); - } - - /** - * @return singleton instance of DomainSourceTypesRegistry - */ - public synchronized static DomainSourceTypesRegistry getInstance() { - if (INSTANCE == null){ - INSTANCE = new DomainSourceTypesRegistry(); - } - return INSTANCE; - } - - /** - * @param domain identifier - * @return list of <code>IDomainSourceModelType</code> sorted in descending order by ordinal - */ - public List/*<IDomainSourceModelType>*/ getDomainSourceTypes(String domain){ - List/*<DomainSourceModelTypeDescriptor>*/ list = getDomainSourceModelDescriptors(domain); - List/*<IDomainSourceModelType>*/ types = new ArrayList/*<IDomainSourceModelType>*/(); - for(Iterator/*<DomainSourceModelTypeDescriptor>*/ it=list.iterator();it.hasNext();){ - DomainSourceModelTypeDescriptor d = (DomainSourceModelTypeDescriptor)it.next(); - types.add(d.getInstance()); - } - //default sort descending by ordinal - Collections.sort(types, new Comparator(){ - public int compare(Object o1, Object o2) { - DomainSourceModelTypeImpl desc1 = (DomainSourceModelTypeImpl)o1; - DomainSourceModelTypeImpl desc2 = (DomainSourceModelTypeImpl)o2; - if (desc1.getOrdinal() == desc2.getOrdinal()) - return 0; - if (desc1.getOrdinal() > desc2.getOrdinal()) - return -1; - - return 1; - } - - }); - - return types; - } - - private List getDomainSourceModelDescriptors(String domain) { - List ret = (List)getDescriptors().get(domain); - if (ret != null && ret.size()>0) - return ret; - - return getDefaultSourceModelDescriptor(); - } - - private List getDefaultSourceModelDescriptor() { - List ret = new ArrayList(); - DomainSourceModelTypeDescriptor desc = new DomainSourceModelTypeDescriptor(); - ret.add(desc); - return ret; - } - - private synchronized void init() { - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, EXTENSION_POINT_ID ); - if (point != null) { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - IConfigurationElement element = elements[i]; - addDomainSourceTypeDescriptor(element); - } - } - } - - private void addDomainSourceTypeDescriptor(IConfigurationElement element) { - String domainId = element.getAttribute("domainId"); //$NON-NLS-1$ - String srcHdlrId = element.getAttribute("domainSourceModelTypeId"); //$NON-NLS-1$ - String locator = element.getAttribute("locator"); //$NON-NLS-1$ - String ordinalStr = element.getAttribute("ordinal"); //$NON-NLS-1$ - int ordinal = 1; - if (ordinalStr!=null && !ordinalStr.equals("")){ //$NON-NLS-1$ - ordinal = Integer.parseInt(ordinalStr); - } - DomainSourceModelTypeDescriptor d = new DomainSourceModelTypeDescriptor(domainId, srcHdlrId, locator, element.getContributor().getName(), ordinal); - List/*<DomainSourceTypeDescriptor>*/ descs = (List)getDescriptors().get(domainId); - if (descs == null){ - descs = new ArrayList/*<DomainSourceTypeDescriptor>*/(); - getDescriptors().put(domainId, descs); - } - descs.add(d); - } - - private Map/*<String, List/*<DomainSourceTypeDescriptor>>*/ getDescriptors() { - if (domainSourceTypeDescriptors == null){ - domainSourceTypeDescriptors = new HashMap/*<String, List/*<DomainSourceTypeDescriptor>>*/(); - } - return domainSourceTypeDescriptors; - } - -// private Map/*<String, List/*<IDomainSourceModelType>>*/ getDomainSourceTypes() { -// if (domainSourceTypes == null){ -// domainSourceTypes = new HashMap/*<String, List/*<IDomainSourceModelType>>*/(); -// } -// return domainSourceTypes; -// } - -}
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IClassLoaderProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IClassLoaderProvider.java deleted file mode 100644 index 6c8169616..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IClassLoaderProvider.java +++ /dev/null @@ -1,22 +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.common.metadata.internal; - -/** - * Provides class loading by using the plugin's classloader that defined an item of metadata - */ -public interface IClassLoaderProvider { - /** - * @param className - * @return Class - implementers should eat exceptions and return null whenever class cannot be returned - */ - public Class loadClass(String className); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainLoadingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainLoadingStrategy.java deleted file mode 100644 index ee21e6249..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainLoadingStrategy.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - - -/** - * Defines a strategy to use for loading a standard metadata model for a certain domain. - * see <code>org.eclipse.jst.jsf.common.domainLoadingStrategies</code> ext-pt - */ -public interface IDomainLoadingStrategy { - - /** - * Create a merged "standard" metadata model. - * @param model to load - * - */ - public void load(MetaDataModel model); - - /** - * Reload a merged "standard" metadata model. - * Allows for some optimization for reload. - * @throws ModelNotSetException - * - */ - public void reload() throws ModelNotSetException; - - - /** - * Opportunity to cleanup and should be called when strategy is being destroyed - */ - public void cleanup(); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainSourceModelType.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainSourceModelType.java deleted file mode 100644 index 67ed29214..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IDomainSourceModelType.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.Set; - -import org.eclipse.core.resources.IProject; - -/** - * Binds a domain of metadata to a source model type which is defined by a {@link IMetaDataLocator} - * and set of {@link IMetaDataTranslator}s - * Not intended to be implemented by clients. Created from ext-pts. - */ -public interface IDomainSourceModelType { - /** - * @return domain id - */ - public String getDomain(); - /** - * @param project - may be null - * @return instance of IMetaDataLocator - may return null if the locator cannot operate in the current context - */ - public IMetaDataLocator getLocator(IProject project); -// public int getOrdinal(); - /** - * @return set of {@link IMetaDataTranslator}s for the domain source model type - */ - public Set/*<IMetaDataTranslator>*/ getTranslators(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IImageDescriptorProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IImageDescriptorProvider.java deleted file mode 100644 index 9405a6a64..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IImageDescriptorProvider.java +++ /dev/null @@ -1,25 +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.common.metadata.internal; - -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Provides image descriptors relative to the plugin that provided the image metadata - * - */ -public interface IImageDescriptorProvider { - /** - * @param imagePath - * @return ImageDescriptor - implementers should eat exceptions and return null whenever imageDescriptor cannot be returned - */ - public ImageDescriptor getImageDescriptor(String imagePath); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataChangeNotificationEvent.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataChangeNotificationEvent.java deleted file mode 100644 index 29c6ce13f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataChangeNotificationEvent.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Experimental and not used at the moment. - * - */ -public interface IMetaDataChangeNotificationEvent { - //change to enums if we do Java5 - /** - * TODO: - */ - public static final int ADDED = 1; - /** - * TODO: - */ - public static final int REMOVED = 2; - /** - * TODO: - */ - public static final int CHANGED = 3; - - /** - * @return the uri - */ - public String getURI(); - /** - * @return when to the event types above - */ - public int getEventType(); - /** - * @return the meta-data locator - */ - public IMetaDataLocator getLocator(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataLocator.java deleted file mode 100644 index ffdbd62ce..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.List; - -/** - * Locates instances of metadata of a specific source model type - */ -public interface IMetaDataLocator { - /** - * @param uri - * @return a list of <code>IMetaDataModelProvider</code>s for the uri located by this instance - */ - public List/*<IMetaDataModelProvider>*/ locateMetaDataModelProviders(String uri); - - /** - * Opportunity for service to start (add listeners, etc.). - * Framework calls this immediately after construction and all setup should occur at this time. - */ - public void startLocating(); - /** - * Stop looking for instances of metadata model sources. An opportunity to cleanup. - */ - public void stopLocating(); - - /** - * @param observer add a {@link IMetaDataObserver} of this locator - */ - public void addObserver(IMetaDataObserver observer); - /** - * @param observer remove a {@link IMetaDataObserver} of this locator - */ - public void removeObserver(IMetaDataObserver observer); - - /** - * @return IDomainSourceModelType instance that created this locator - */ - public IDomainSourceModelType getDomainSourceModelType(); - /** - * @param domainSourceModelType set the domainSourceModelType instance that created this locator - */ - public void setDomainSourceModelType(IDomainSourceModelType domainSourceModelType); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelMergeAssistant.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelMergeAssistant.java deleted file mode 100644 index 0a6a341be..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataModelMergeAssistant.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.Trait; - - -/** - * Helper class interface to merge source models into a single merged model. - * Not intended to be implemented by clients - * - */ -public interface IMetaDataModelMergeAssistant { - /** - * @return merged model - */ - public MetaDataModel getMergedModel(); - /** - * Method that will first check to see if an entity with the same id exists in the merged model. - * If not, it will add it. The entities includeGroups are then also merged. - * @param entity - * @return the merged model entity - * - */ - public Entity addEntity(Entity entity); - /** - * Method will add an entity if not already existing in the merged model, and then check for an existing trait by id on the merged model's entity. - * @param entity - * @param trait - * @return flag indicating whether or not the traits was new and therefore added to the merged model's entity - */ - public boolean addTrait(Entity entity, Trait trait); - - /** - * Method will add an entityGroup to the model if not already exiting in the merged model (by id). - * @param entityGroup - */ - public void addEntityGroup(EntityGroup entityGroup); - /** - * Signal that the merge is complete so that any post-processing may occur. - * This should be the last call made on the merge assistant and should be done before client calls for the merged model result. - * This should signal that entityGroups processing should begin. - */ - public void setMergeComplete(); - - /** - * @param mds - {@link IMetaDataSourceModelProvider} - */ - public void setSourceModelProvider(IMetaDataSourceModelProvider mds); - /** - * @return {@link IMetaDataSourceModelProvider} for current operation - */ - public IMetaDataSourceModelProvider getSourceModelProvider(); - - /** - * @param queryRoot - * @param entityKey - key relative to queryRoot - * @return entity - will return null if not found - */ - public Entity getMergedEntity(Entity queryRoot, String entityKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObservable.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObservable.java deleted file mode 100644 index 69152d34d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObservable.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Allows {@link IMetaDataObserver}s to observe changes. - * Experimental. - * - */ -public interface IMetaDataObservable { - /** - * Add the observer to the set of observers. Has no effect if - * the same observer is already registered - * - * @param observer - */ - public void addObserver(IMetaDataObserver observer); - - /** - * Remove the observer from the set of observers. Has no effect - * if observer was not already registered. - * - * @param observer must not be null - */ - public void removeObserver(IMetaDataObserver observer); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObserver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObserver.java deleted file mode 100644 index 5a138a33a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataObserver.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Interface for notification when an {@link IMetaDataObservable} changes - * - */ -public interface IMetaDataObserver { - /** - * Callback to observer when an {@link IMetaDataObservable} throws an event - * @param event - */ - public void notifyMetadataChanged(IMetaDataChangeNotificationEvent event); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataSourceModelProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataSourceModelProvider.java deleted file mode 100644 index 6a19c3bb0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataSourceModelProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.runtime.IAdaptable; - - -/** - * Provides a source of metadata that can be transformed into a merged standard model - * LIKELY TO CHANGE - */ -public interface IMetaDataSourceModelProvider extends IAdaptable{ - /** - * @return the source model - */ - public Object getSourceModel(); - /** - * @return the IMetaDataLocator instance that located this model provider instance - */ - public IMetaDataLocator getLocator(); - /** - * @param locator instance that located this model provider instance - */ - public void setLocator(IMetaDataLocator locator); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataTranslator.java deleted file mode 100644 index 2a7f6e2e9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IMetaDataTranslator.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Translate from the source model metadata structure into a standard metadata domain of metadata. - * - */ -public interface IMetaDataTranslator { - /** - * @param assistant perform translation using the IMetaDataModelMergeAssistant - */ - public void translate(IMetaDataModelMergeAssistant assistant); - /** - * @param modelProvider - cannot be null - * @return true if this translator can translate this model source - */ - public boolean canTranslate(IMetaDataSourceModelProvider modelProvider); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IPathSensitiveMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IPathSensitiveMetaDataLocator.java deleted file mode 100644 index 0f0ed7125..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IPathSensitiveMetaDataLocator.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.resources.IProject; - -/** - * A <code>IMetaDataLocator</code> that is sensitive to the project context - */ -public interface IPathSensitiveMetaDataLocator extends IMetaDataLocator { - /** - * @param project - */ - public void setProjectContext(IProject project); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceBundleProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceBundleProvider.java deleted file mode 100644 index 640da3540..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceBundleProvider.java +++ /dev/null @@ -1,23 +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.common.metadata.internal; - -import java.util.ResourceBundle; - -/** - * Provides the resource bundle from the plugin that defined an item of metadata. - */ -public interface IResourceBundleProvider { - /** - * @return ResourceBundle - implementers should eat exceptions and return null whenever resourceBundle cannot be returned - */ - public ResourceBundle getResourceBundle(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceURLProvider.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceURLProvider.java deleted file mode 100644 index f82d0fbe4..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IResourceURLProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2008 Oracle Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle Corporation - initial API and implementation - */ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.net.URL; - -/** - * Provides absolute URLs from resource path, which is relative to the plug-in - * with the metadata that specified the resource path. - * - * @author Ian Trimble - Oracle - */ -public interface IResourceURLProvider { - - /** - * Get absolute URL for resource path, which is relative to the plug-in that - * specified the resource metadata. - * - * @param resourcePath Path to resource, relative to metadata plug-in. - * @return Absolute URL for resource path. - */ - public URL getResourceURL(String resourcePath); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IStandardMetaDataSourceInfo.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IStandardMetaDataSourceInfo.java deleted file mode 100644 index 02270a31d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/IStandardMetaDataSourceInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - - -/** - * Represents the metadata file defined by the StandardMetaDataFile extension-point - * Not intended to be implemented by clients - */ -public interface IStandardMetaDataSourceInfo { - /** - * @return location of metadata file that the locator class will use - */ - public String getLocation(); - /** - * @return bundle id of plugin defining the metadata file - */ - public String getBundleId(); - /** - * @return class name of the locator that will find the the standard metadata file - */ - public String getLocatorClassname(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/JSPTagLibDomainLoadingStrategy.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/JSPTagLibDomainLoadingStrategy.java deleted file mode 100644 index 9aeb8b4b0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/JSPTagLibDomainLoadingStrategy.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.List; - - -/** - * Strategy for loading tag metadata. Extends and uses the default {@link DomainLoadingStrategy}. - * Mainly exists for illustrative purposes. Could be removed.. - */ -public class JSPTagLibDomainLoadingStrategy extends DomainLoadingStrategy { - - /** - * Constructor - * @param domain - */ - public JSPTagLibDomainLoadingStrategy(String domain) { - super(domain); - } - - /*@Override*/ - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.DomainLoadingStrategy#sortSourceTypes(java.util.List) - */ - protected void sortSourceTypes(List/*<IDomainSourceType>*/ sourceTypes) { - //an opportunity to override the priority of the source types... - } - - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/Messages.java deleted file mode 100644 index 74fd0a7b2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/Messages.java +++ /dev/null @@ -1,40 +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.common.metadata.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Externalized strings for Metadata - */ -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.common.metadata.internal.messages"; //$NON-NLS-1$ - - /** - * Property key not found in bundle - */ - public static String Key_not_found; - - /** - * Missing resource - */ - public static String MissingResource_exception; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - // no external instantiation - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataChangeNotificationEvent.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataChangeNotificationEvent.java deleted file mode 100644 index 8ecc17df6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataChangeNotificationEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Experimental. Subject to change. - * - */ -public class MetaDataChangeNotificationEvent implements - IMetaDataChangeNotificationEvent { - - private String _uri; - private IMetaDataLocator _locator; - private int _type; - - /** - * Constructor - * @param locator - * @param uri - * @param type - */ - public MetaDataChangeNotificationEvent(IMetaDataLocator locator, String uri, int type){ - this._locator = locator; - this._uri = uri; - this._type = type; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent#getEventType() - */ - public int getEventType() { - return _type; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent#getLocator() - */ - public IMetaDataLocator getLocator() { - return _locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataChangeNotificationEvent#getURI() - */ - public String getURI() { - return _uri; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataLocatorFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataLocatorFactory.java deleted file mode 100644 index a590590ec..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataLocatorFactory.java +++ /dev/null @@ -1,169 +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.common.metadata.internal; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - -/** - * Creates instances of IMetaDataLocators and caches them so that there is only one instance of a particular locator - * when client requests one. - */ -public class MetaDataLocatorFactory - implements IResourceChangeListener { - - private static MetaDataLocatorFactory INSTANCE = null; - private Map<String, IMetaDataLocator> _locators; - - private static final boolean DEBUG = false; - /** - * @return singleton instance of the MetaDataLocatorFactory - */ - public synchronized static MetaDataLocatorFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new MetaDataLocatorFactory(); - ResourcesPlugin.getWorkspace().addResourceChangeListener(INSTANCE, IResourceChangeEvent.PRE_CLOSE); - } - return INSTANCE; - } - - - - private Map<String, IMetaDataLocator> getLocators() { - if (_locators == null){ - _locators = new HashMap<String, IMetaDataLocator>(); - } - return _locators; - } - - /** - * @param locatorClassName - may NOT be null - * @param bundleId - may NOT be null - * @param project - may be null - * @return shared instance of IMetaDataLocator - * may return null if is IPathSensitiveMetaDataLocator and there is no project context - */ - public IMetaDataLocator getLocator(final String locatorClassName, final String bundleId, final IProject project){ - final Class klass = JSFCommonPlugin.loadClass(locatorClassName, bundleId); - String key = getKey(locatorClassName, bundleId); - IMetaDataLocator locator = null; - try { - IMetaDataLocator tempLocator = (IMetaDataLocator)klass.newInstance(); - if (tempLocator != null) { - if (tempLocator instanceof IPathSensitiveMetaDataLocator) { - if (project == null) - return null; - - key = getKey(locatorClassName, project.getName()); - } - - locator = getLocators().get(key); - if (locator == null) { - locator = tempLocator; - if (locator instanceof IPathSensitiveMetaDataLocator) - ((IPathSensitiveMetaDataLocator)locator).setProjectContext(project); - - if (DEBUG) - System.out.println("Created locator: "+locator.toString()); //$NON-NLS-1$ - - getLocators().put(key, locator); - locator.startLocating(); - } - } - } catch (InstantiationException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Could not instantiate IMetaDataLocator: "+key, e); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalAccessException while creating IMetaDataLocator: "+key, e); //$NON-NLS-1$ - } - - return locator; - } - - /** - * @param locatorClassName - * @param contextId - this may be the bundleID or the projectName if it is a path sensitive locator - * @return key - */ - private String getKey(final String locatorClassName, final String contextId) { - StringBuffer buf = new StringBuffer(contextId); - buf.append(":"); //$NON-NLS-1$ - buf.append(locatorClassName); - return buf.toString(); - } - - /** - * Stops and disposes all locators - */ - public void dispose(){ - ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); - for (Iterator it=getLocators().values().iterator();it.hasNext();){ - IMetaDataLocator locator = (IMetaDataLocator)it.next(); - locator.stopLocating(); - } - getLocators().clear(); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org - * .eclipse.core.resources.IResourceChangeEvent) - */ - public void resourceChanged(final IResourceChangeEvent event) { - if (event.getType() == IResourceChangeEvent.PRE_CLOSE - || event.getType() == IResourceChangeEvent.PRE_DELETE) { - // a project is closing - release and cleanup - final IProject aProject = (IProject) event.getResource(); - - if (aProject != null) { - List<String> locatorsToRemove = new ArrayList<String>(); - for (Iterator it=getLocators().keySet().iterator();it.hasNext();){ - String key = (String)it.next(); - if (locatorIsForProject(key, aProject.getName())) { - locatorsToRemove.add(key); - } - } - - if (! locatorsToRemove.isEmpty()) { - for (String key : locatorsToRemove) { - IMetaDataLocator locator = getLocators().get(key); - - if (DEBUG) - System.out.println("Removed locator: "+locator.toString()); //$NON-NLS-1$ - - locator.stopLocating(); - getLocators().remove(key); - } - } - } - } - } - - private boolean locatorIsForProject(final String key, final String projectName) { - StringTokenizer t = new StringTokenizer(key, ":"); //$NON-NLS-1$ - String contextId = t.nextToken(); - if (contextId.equals(projectName)) - return true; - return false; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModel.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModel.java deleted file mode 100644 index ef41dbca9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModel.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.Model; - -/** - * Responsible for loading and holding onto the standard metadata model using the IDomainLoadingStrategy. - * Wraps the model (root) with the strategy used for loading it, along with the identifying key (modelKeyDescriptor) - */ -public class MetaDataModel { - - private Object root; - private ModelKeyDescriptor modelKeyDescriptor; - private IDomainLoadingStrategy strategy; - private boolean refresh; - - /** - * Constructor - * @param key - * @param strategy - */ - public MetaDataModel(ModelKeyDescriptor key, IDomainLoadingStrategy strategy){ - this.modelKeyDescriptor = key; - this.strategy = strategy; - } - - /** - * @return the root of the model. - */ - public Object getRoot(){ - return root; - } - - /** - * @param root - */ - public void setRoot(Object root){ - this.root = root; - if (root != null) - ((Model)root).setCurrentModelContext(modelKeyDescriptor); - } - - /** - * @return ModelKeyDescriptor for this model - */ - public ModelKeyDescriptor getModelKey(){ - return modelKeyDescriptor; - } - -// public void accept(IEntityVisitor visitor){ -// if (getRoot() instanceof Model) -// visitor.visit((Model)getRoot()); -// } - - /** - * @return true if the model is null or is not, in fact, a {@link Model} - */ - public boolean isEmpty() { - if (root == null || !(root instanceof Model)) - return true; - - return false; - } - - /** - * Load the model. Delegates to the strategy. - */ - public synchronized void load(){ - StandardModelFactory.debug("> Begin Loading: "+getModelKey(), StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - strategy.load(this); - StandardModelFactory.debug("> End Loading: "+getModelKey(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - } - - /** - * Reloads the model delegating to strategy reload - * @throws ModelNotSetException - */ - public void reload()throws ModelNotSetException{ - setRoot(null); - refresh = false; - strategy.reload(); - } - - /** - * @return flag indicating that the model is stale - */ - public boolean needsRefresh() { - return refresh; - } - - /** - * Flag that model is stale - */ - public void setNeedsRefresh() { - refresh = true; - } - - /** - * Cleans up the model releasing references. - */ - public void cleanup(){ - if (strategy != null) - strategy.cleanup(); - strategy = null; - root = null; - modelKeyDescriptor = null; - } - - public String toString() { - StringBuffer buf = new StringBuffer("MetaDataModel: "); //$NON-NLS-1$ - buf.append(getModelKey()); - return buf.toString(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContextImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContextImpl.java deleted file mode 100644 index 03a99fadd..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelContextImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.jst.jsf.common.metadata.query.IMetaDataModelContext; - -/** - * Simple implementation of {@link IMetaDataModelContext} - * - */ -public class MetaDataModelContextImpl implements IMetaDataModelContext, Cloneable { - private final String _domain; - - /** - * Constructor - * @param domain id - */ - public MetaDataModelContextImpl(final String domain){ - _domain = domain; - } - - public String getDomainID() { - return _domain; - } - - public Object getAdapter(final Class adapter) { - if (IMetaDataModelContext.class.equals(adapter)) - return this; - return null; - } - - @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManager.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManager.java deleted file mode 100644 index e5297b657..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelManager.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.jface.util.SafeRunnable; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; - -/** - * Singleton instance for each IProject used to manage all standard metdata models for that project. - * - * Manager is responsible for loading and caching MetaDataModels. Models are keyed by URI. - * - * The manager listens for project closing resource events so that the resources can be freed up. - */ -public class MetaDataModelManager implements IResourceChangeListener{ - /** - * Key that is used for the IProject instance's session property that - * holds a MetaDataModelManager instance. Each project will have it's own instance of a model manager. - */ - public static final QualifiedName KEY_SESSIONPROPERTY = - new QualifiedName(null, "MetaDataModelManager"); //$NON-NLS-1$ FIX ME - - private static MetaDataModelManager SHARED_INSTANCE; - - // used to lock all instance calls for getModel - private static final Object GLOBAL_INSTANCE_LOCK = new Object(); - private final ModelMap models; - private final IProject project; - - - /** - * @return instance that is project agnostic. * may get removed * - */ - public synchronized static MetaDataModelManager getSharedInstance(){ - if (SHARED_INSTANCE == null) { - SHARED_INSTANCE = new MetaDataModelManager(null); - } - return SHARED_INSTANCE; - } - - /** - * @param project - * @return instance of the model manager for this project. Shouldn't, but may, return null. - */ - public synchronized static MetaDataModelManager getInstance(final IProject project){ - MetaDataModelManager repo = null; - if (project != null && project.isAccessible()) { - repo = getFromSessionProperty(project); - if (repo == null) { - repo = new MetaDataModelManager(project); - ResourcesPlugin.getWorkspace().addResourceChangeListener( - repo, - (IResourceChangeEvent.PRE_CLOSE - | IResourceChangeEvent.PRE_DELETE)); - } - } - return repo; - } - private MetaDataModelManager(final IProject project) { - this.project = project; - models = new ModelMap(); - setAsSessionProperty(); - } - - /** - * @param project - * @return MetaDataModelManager instance for the project - */ - private static MetaDataModelManager getFromSessionProperty(final IProject project) { - MetaDataModelManager repo = null; - try { - Object obj = project.getSessionProperty(KEY_SESSIONPROPERTY); - if (obj instanceof MetaDataModelManager) { - repo = (MetaDataModelManager)obj; - } - } catch(CoreException ce) { - JSFCommonPlugin.log(IStatus.ERROR, "Internal Error: Unable to recover MetaDataModelManager for: "+project.getName(), ce); //$NON-NLS-1$ - } - return repo; - } - - /** - * Sets this MetaDataModelManager instance as a session property of its - * IProject instance. - */ - private void setAsSessionProperty() { - if (project != null && project.isAccessible()) { - try { - project.setSessionProperty(KEY_SESSIONPROPERTY, this); - } catch(CoreException ce) { - JSFCommonPlugin.log(IStatus.ERROR, "Internal Error: Unable to store MetaDataModelManager for: "+project.getName(), ce); //$NON-NLS-1$ } - } - } - } - - /** - * Releases a project's MetaDataModelManager instance by removing from project session property - * @param aProject - */ - private void removeAsSessionProperty(final IProject aProject){ - try { - ResourcesPlugin.getWorkspace().removeResourceChangeListener(this); - aProject.setSessionProperty(KEY_SESSIONPROPERTY, null); - } catch (CoreException e) { - JSFCommonPlugin.log(e, "Error removing session property"); //$NON-NLS-1$ - } - } - - /** - * Will locate the cached MetaDataModel. Sets the model context in the - * model. - * - * @param modelContext - * @return the MetaDataModel for the given ITaglibDomainMetaDataModelContext - */ - public MetaDataModel getModel( - final ITaglibDomainMetaDataModelContext modelContext) { - synchronized (GLOBAL_INSTANCE_LOCK) { - ModelKeyDescriptor modelKeyDescriptor = StandardModelFactory.getInstance().createModelKeyDescriptor(modelContext); - - StandardModelFactory.debug(">START getModel: "+modelKeyDescriptor, StandardModelFactory.DEBUG_MD_GET); //$NON-NLS-1$ - - MetaDataModel model = models.get(modelKeyDescriptor); - if (model == null) { - // long in = System.currentTimeMillis(); - model = loadMetadata(modelKeyDescriptor); - //System.out.println("Time to load "+modelContext.getURI()+": "+ - // String.valueOf(System.currentTimeMillis() - in)); - } else if (model.needsRefresh()) { - try { - model.reload(); - } catch (ModelNotSetException e) { - // simply load it - should not get here - model = loadMetadata(modelKeyDescriptor); - } - } - if (model != null && model.getRoot() != null) - ((Model) model.getRoot()) - .setCurrentModelContext(modelKeyDescriptor); - - StandardModelFactory.debug(">END getModel: "+modelKeyDescriptor, StandardModelFactory.DEBUG_MD_GET); //$NON-NLS-1$ - return model; - } - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org - * .eclipse.core.resources.IResourceChangeEvent) - */ - public void resourceChanged(final IResourceChangeEvent event) { - if (event.getType() == IResourceChangeEvent.PRE_CLOSE - || event.getType() == IResourceChangeEvent.PRE_DELETE) { - // a project is closing - release and cleanup - final IProject aProject = (IProject) event.getResource(); - if (aProject != null && aProject.equals(this.project)) { - SafeRunnable.run(new ISafeRunnable() { - - public void handleException(Throwable exception) { - JSFCommonPlugin.log(exception); - } - - public void run() throws Exception { - models.dispose(); - removeAsSessionProperty(project); - } - }); - } - } - } - - private MetaDataModel loadMetadata(final ModelKeyDescriptor modelKeyDescriptor) { - if (!Thread.holdsLock(GLOBAL_INSTANCE_LOCK)) { - JSFCommonPlugin - .log(IStatus.ERROR, - "Internal Error: loadMetadata must not be called if class lock not held"); //$NON-NLS-1$ - return null; - } - - final IDomainLoadingStrategy strategy = DomainLoadingStrategyRegistry - .getInstance().getLoadingStrategy( - modelKeyDescriptor.getDomain()); - ; - if (strategy == null) { - JSFCommonPlugin - .log( - IStatus.ERROR, - "Internal Error: Unable to locate metadata loading strategy for: " + modelKeyDescriptor.toString()); //$NON-NLS-1$ - return null; - } - final MetaDataModel model = StandardModelFactory.getInstance().createModel( - modelKeyDescriptor, strategy);// new MetaDataModel(modelKey, - // strategy); - model.load(); - addModel(model); - - return model; - } - - private void addModel(final MetaDataModel model) { - if (model != null) - models.put(model); - } - - /** - * Map of models keyed by ModelKeyDescriptor (.toString()) - * - */ - private static class ModelMap - { - private final Map<String, MetaDataModel> map; - private final AtomicBoolean _isDisposed = new AtomicBoolean(false); - - ModelMap() { - map = new HashMap<String, MetaDataModel>(); - } - - /** - * @param model - * adds model to the map using the given key descriptor - */ - public void put(final MetaDataModel model) { - assert !_isDisposed.get(); - final String key = calculateKey(model); - synchronized (this) { - map.put(key, model); - } - } - - /** - * @param modelKeyDescriptor - * @return MetaDataModel for this ModelKeyDescriptor. May return null. - */ - public MetaDataModel get(final ModelKeyDescriptor modelKeyDescriptor) { - assert !_isDisposed.get(); - - final String key = calculateKey(modelKeyDescriptor); - - synchronized (this) - { - return map.get(key); - } - } - -// /** -// * @param model -// * from the map -// */ -// public void remove(final MetaDataModel model) { -// assert !_isDisposed.get(); -// final String key = calculateKey(model); -// synchronized(this) -// { -// map.remove(key); -// } -// } - - public void dispose() { - if (_isDisposed.compareAndSet(false, true)) { - synchronized(this) - { - for (final Iterator<Map.Entry<String, MetaDataModel>> it = map.entrySet().iterator(); it.hasNext();) - { - // System.out.println("kill mmModel: "+model.toString()); - final Map.Entry<String, MetaDataModel> entry = it.next(); - final MetaDataModel model = entry.getValue(); - - if (model != null) - { - model.cleanup(); - } - it.remove(); - } - } - } - } - - private String calculateKey(final MetaDataModel model) - { - return calculateKey(model.getModelKey()); - } - - private String calculateKey(final ModelKeyDescriptor modelKeyDescriptor) - { - return modelKeyDescriptor.toString(); - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelMergeAssistantImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelMergeAssistantImpl.java deleted file mode 100644 index 0c53521b0..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/MetaDataModelMergeAssistantImpl.java +++ /dev/null @@ -1,395 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.util.EcoreUtil.Copier; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; -import org.eclipse.jst.jsf.common.metadata.query.MetaDataException; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; -import org.eclipse.jst.jsf.common.metadata.query.internal.SearchControl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleEntityQueryVisitorImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleResultSet; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleTraitQueryVisitorImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; -/** - * Implements {@link IMetaDataModelMergeAssistant} - * - * Responsible for merging source models into one. The first model in has subsequent - * entities and traits added to it. - * - * TODO - make locating of existing entities and traits in the merged model more efficient - * TODO - refactor out Taglibdomain-only aspects of include-group processing - * - */ -public class MetaDataModelMergeAssistantImpl implements - IMetaDataModelMergeAssistant { - - private MetaDataModel mergedModel; - private SimpleEntityQueryVisitorImpl entityVisitor; - private SimpleTraitQueryVisitorImpl traitVisitor; - private IMetaDataSourceModelProvider provider; - - /** - * Constructor. Queries with search control limited to first found. - * @param model - */ - public MetaDataModelMergeAssistantImpl(final MetaDataModel model) { - this.mergedModel = model; - entityVisitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, - HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - traitVisitor = new SimpleTraitQueryVisitorImpl(new SearchControl(1)); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#getMergedModel() - */ - public MetaDataModel getMergedModel() { - return mergedModel; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#getSourceModel() - */ - public IMetaDataSourceModelProvider getSourceModelProvider() { - return provider; - } - - public void setSourceModelProvider(final IMetaDataSourceModelProvider provider) { - this.provider = provider; - } - - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#addEntityGroup(org.eclipse.jst.jsf.common.metadata.EntityGroup) - */ - public void addEntityGroup(final EntityGroup entityGroup) { - final Model model = (Model)getMergedModel().getRoot(); - if (!isExistingEntityGroup(model, entityGroup)){ - model.getEntityGroups().add(entityGroup); - } - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#addEntity(org.eclipse.jst.jsf.common.metadata.Entity) - */ - public Entity addEntity(final Entity entity) { - Entity mmEntity = getMergedEntity(entity); - if (mmEntity == null){ - mmEntity = addEntityAsNecessary((Entity)entity.eContainer(), entity); - return mmEntity; - } - addIncludeGroupsAsNecessary(mmEntity, entity); - return mmEntity; - } - - public Entity getMergedEntity(final Entity queryRoot, final String entityKey){ - Entity ret = null; - SimpleResultSet rs = (SimpleResultSet)entityVisitor.findEntities(queryRoot, entityKey); - try { - if (! rs.getResults().isEmpty()) - ret = (Entity)rs.getResults().get(0); - rs.close(); - } catch (MetaDataException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getMergedEntity()", e); //$NON-NLS-1$ - } - return ret; - } - private void addIncludeGroupsAsNecessary(final Entity mmEntity, final Entity entity) { - for (final Iterator it=entity.getIncludeGroups().iterator();it.hasNext();){ - final IncludeEntityGroup grp = (IncludeEntityGroup)it.next(); - boolean found = false; - for (Iterator it2=mmEntity.getIncludeGroups().iterator();it2.hasNext();){ - final IncludeEntityGroup grp2 = (IncludeEntityGroup)it2.next(); - if (grp2.equals(grp)){ - found = true; - break; - } - } - if (!found){//maybe we should clone and add - mmEntity.getIncludeGroups().add(grp); - } - } - } - - /** - * Checks to see if the entity (by id) is present in the mergedModel or not. - * If not, it will perform a copy of the entity and it's attributes using - * EcoreUtil.Copier. - * - * @param parent - * @param entity - * @return - */ - private Entity addEntityAsNecessary(final Entity parent, final Entity entity) { - Entity mmParent = null; - Entity mmEntity = null; - if (parent != null){ - mmParent = getMergedEntity(parent); - if (mmParent == null){ - mmParent = addEntityAsNecessary((Entity)entity.eContainer(), entity); - } - } - if (mmParent != null){ - mmEntity = addEntityInternal(mmParent, entity); - return mmEntity; - } - return mmEntity; - } - - private boolean isExistingEntityGroup(final Model model, final EntityGroup entityGroup) { - boolean found = false; - for(final Iterator it=model.getEntityGroups().iterator();it.hasNext();){ - if (entityGroup.getId().equals(((EntityGroup)it.next()).getId())) - return true; - } - return found; - } - - private Entity getExistingChildEntity(final Entity parent, final Entity entity) { - for(final Iterator it=parent.getChildEntities().iterator();it.hasNext();){ - final Entity foundEntity = (Entity)it.next(); - if (entity.getId().equals(foundEntity.getId())) - return foundEntity; - } - return null; - } - - private /*synchronized*/ Entity addEntityInternal(final Entity parent, final Entity entity) { - final Copier copier = new Copier(); - final Entity mmEntity =(Entity)copier.copy(entity); - copier.copyReferences(); - parent.getChildEntities().add(mmEntity); - return mmEntity; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#addTrait(org.eclipse.jst.jsf.common.metadata.Entity, org.eclipse.jst.jsf.common.metadata.Trait) - */ - public boolean addTrait(final Entity entity, final Trait trait) { - final Entity returnedEntity = getMergedEntity(entity); - if (returnedEntity != null){ - return addTraitAsNecessary(returnedEntity, trait); - } - return false; - } - - - private boolean addTraitAsNecessary(Entity mergedEntity, Trait trait) { - final Trait mmTrait = getMergedTrait(mergedEntity, trait); - if (mmTrait == null){ - addTraitInternal(mergedEntity, trait); - return true; - - } - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataModelMergeAssistant#setMergeComplete() - */ - public void setMergeComplete() { - final Model model = (Model)getMergedModel().getRoot(); - if (model != null){ - StandardModelFactory.debug(">> Begin processIncludeGroups for: "+getMergedModel().getModelKey(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - - processIncludeGroups(model); - - StandardModelFactory.debug(">> End processIncludeGroups for: "+getMergedModel().getModelKey(),StandardModelFactory.DEBUG_MD_LOAD); //$NON-NLS-1$ - } - } - - /** - * Copies the passed trait and adds it to the merged entity. - * The source model provider of the trait is then set on the trait so that - * the trait can know where it came from. - * - * @param parent - * @param trait - * @return merged Trait - */ - private Trait addTraitInternal(final Entity parent, final Trait trait) { - final Copier copier = new Copier(); - final Trait mmTrait =(Trait)copier.copy(trait); - copier.copyReferences(); - parent.getTraits().add(mmTrait); - //set the model key to know from where the trait came - mmTrait.setSourceModelProvider(trait.getSourceModelProvider()); - return mmTrait; - } - - /** - * Locates the entity in the merged model matching by id only. - * If not located, this method returns null; - * - * @param entity - * @return merged entity - */ - private Entity getMergedEntity(final Entity entity){ - if (entity instanceof Model) - return (Entity)mergedModel.getRoot(); - - Entity ret = null; - final String entityKey = getIdRelativeToRoot(entity); - final SimpleResultSet rs = (SimpleResultSet)entityVisitor.findEntities((Entity)mergedModel.getRoot(), entityKey); - try { - if (! rs.getResults().isEmpty()) - ret = (Entity)rs.getResults().get(0); - rs.close(); - } catch (MetaDataException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getMergedEntity()", e); //$NON-NLS-1$ - } - return ret; - } - - private String getIdRelativeToRoot(final Entity entity) { - Entity e = entity; - final StringBuffer buf = new StringBuffer(); - while (e.eContainer() != null){ - buf.insert(0, e.getId()); - if (e.eContainer()!=null && e.eContainer().eContainer() != null) - buf.insert(0,"/"); //$NON-NLS-1$ - e = (Entity)e.eContainer(); - } - return buf.toString(); - } - - /** - * Locates the trait in the merged model matching by id only. - * If not located, this method returns null; - * - * @param entity - * @param trait - * @return merged Trait - */ - public Trait getMergedTrait(final Entity entity, final Trait trait){ - final SimpleResultSet rs = (SimpleResultSet)traitVisitor.findTraits(entity, trait.getId()); - Trait ret = null; - try { - if (! rs.getResults().isEmpty()) - ret = (Trait)rs.getResults().get(0); - rs.close(); - } catch (MetaDataException e) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in getMergedTrait()", e); //$NON-NLS-1$ - } - return ret; - } - - private void processIncludeGroups(final Model root) { - addEntityGroupReferencesRecursively(root); - } - - private void addEntityGroupReferencesRecursively(final Entity entity) { - doIncludes(entity); - for (int i=0, size=entity.getChildEntities().size();i<size;i++){ - addEntityGroupReferencesRecursively((Entity)entity.getChildEntities().get(i)); - } - } - - private void doIncludes(final Entity entity){ - for (int j=0, groupsSize=entity.getIncludeGroups().size();j<groupsSize; j++){ - final IncludeEntityGroup include = (IncludeEntityGroup)entity.getIncludeGroups().get(j); - if (include.getId() != null){ - //is this a local merge? - if (include.getModelUri() == null|| - (include.getModelUri() - .equals(getMergedModel() - .getModelKey().getUri())) ){ - final EntityGroup eg = ((Model)getMergedModel().getRoot()).findIncludeGroup(include.getId()); - addIncludeRefs(entity, eg); - } else //external model include - addIncludeRefs(entity, include); - } - } - } - /* - * Adds traits and child entities from an external entity group to the passed entity - * @param entity - * @param include - */ - private void addIncludeRefs(final Entity entity, final IncludeEntityGroup include) { - final ITaglibDomainMetaDataModelContext modelContext = new TaglibDomainMetaDataModelContextImpl( - getMergedModel().getModelKey().getDomain(), - getMergedModel().getModelKey().getProject(), - include.getModelUri() - ); - - final Model externalModel = TaglibDomainMetaDataQueryHelper.getModel(modelContext); - if (externalModel != null){ - final EntityGroup entityGroup = externalModel.findIncludeGroup(include.getId()); - addIncludeRefs(entity, entityGroup); - } - else { - JSFCommonPlugin.log(IStatus.ERROR, "Unable to load external metadata model refs for "+modelContext.getURI() //$NON-NLS-1$ - + " into "+ entity.getModel().getCurrentModelContext().getUri()); //$NON-NLS-1$ - } - } - - /* - * Adds traits and child entities from a local entity group to the passed entity if not already present for the entity. - * First - * @param entity - * @param entityGroup - */ - private void addIncludeRefs(final Entity entity, final EntityGroup entityGroup) { - if (entityGroup == null) - return; - - for (int i=0, size=entityGroup.getTraits().size();i<size;i++){ - addTrait(entity, (Trait)entityGroup.getTraits().get(i)); - } - - for (int i=0, size=entityGroup.getChildEntities().size();i<size;i++){ - traverseAndAddIncludes(entity, (Entity)entityGroup.getChildEntities().get(i)); - } - } - - private void traverseAndAddIncludes(final Entity parent, final Entity entity){ - final Entity mergedEntity = addIncludedEntityAsNecessary(parent, entity); - - for (final Iterator/*<Trait>*/ it=entity.getTraits().iterator();it.hasNext();){ - final Trait trait = (Trait)it.next(); - addTraitAsNecessary(mergedEntity, trait); - } - - for (final Iterator/*<EntityKey>*/ it=entity.getChildEntities().iterator();it.hasNext();){ - final Entity e = (Entity)it.next(); - traverseAndAddIncludes(mergedEntity, e);//add as normal - } - - } - - /* - * Checks to see if the entity (by id) is present as a child entity in the parent or not. - * If not, it will add the entity to the childEntities without copying. - * - * @param parent - * @param entity - * @return Entity - */ - private Entity addIncludedEntityAsNecessary(final Entity parent, final Entity entity) { - Entity mergedEntity = getExistingChildEntity(parent, entity); - if (mergedEntity == null){ - mergedEntity = addEntityInternal(parent, entity); - } - return mergedEntity; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelKeyDescriptor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelKeyDescriptor.java deleted file mode 100644 index 380d21844..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelKeyDescriptor.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.resources.IProject; - -/** - * Meta data model key descriptor used to lazily load a model when it is required - * - */ -public class ModelKeyDescriptor { - private final IProject project; - private final String domain; - private final String uri; - private final String key; - - /** - * Constructor - * @param project - * @param domain - * @param uri - */ - public ModelKeyDescriptor(final IProject project, final String domain, final String uri){ - this.project = project; - this.domain = domain; - this.uri = fixJSPURIIfNecessary(uri); - final String proj = project != null ? project.getName() : "Null"; //$NON-NLS-1$ - final StringBuffer buf = new StringBuffer(proj); - buf.append(":"); //$NON-NLS-1$ - buf.append(this.domain); - buf.append(":"); //$NON-NLS-1$ - buf.append(this.uri); - key = buf.toString(); - } - - //this is a workaround for issue where jsp "uri" may upper or lower cased - private String fixJSPURIIfNecessary(final String tempuri) { - if (tempuri != null && tempuri.equals("jsp11")) //$NON-NLS-1$ - return tempuri.toUpperCase(); - return tempuri; - } - - /** - * @return domain id - */ - public final String getDomain(){ - return domain; - } - - /** - * @return model uri - */ - public final String getUri(){ - return uri; - } - - /** - * @return project - */ - public final IProject getProject(){ - return project; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public final String toString(){ - return key; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelNotSetException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelNotSetException.java deleted file mode 100644 index 34b90b125..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ModelNotSetException.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Experimental - * - */ -public class ModelNotSetException extends Exception { - private static final long serialVersionUID = 1L; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java deleted file mode 100644 index db7ed2a06..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java +++ /dev/null @@ -1,97 +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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.osgi.framework.Bundle; - -/** - * Default implementation of StandardMetaDataSourceFileLocator that will locate standard metadata files - * and resource bundles relative to the plugin that registered the files using the - * <code>org.eclipse.jst.jsf.common.StandardMetaDataFiles</code> ext-pt. - * - */ -public class PluginRelativeStandardMetaDataSourceFileLocator extends StandardMetaDataSourceFileLocator{ - - private ResourceBundle resourceBundle; - - /* - * Returns InputStream of standard metadata file from plugin relative location. - * - */ - public InputStream getInputStream() throws IOException { - URL url = getURL(); - if (url != null) - return url.openStream(); - - String fileName = Path.fromOSString(fileInfo.getLocation()).toString() + " (Plugin: " + fileInfo.getBundleId()+")" ; //$NON-NLS-1$ //$NON-NLS-2$ - throw new FileNotFoundException("Metadata file not found: "+ fileName); //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataSourceFileLocator#getURL() - */ - public URL getURL() { - final Bundle bundle = Platform.getBundle(fileInfo.getBundleId()); - if (bundle == null) - { - return null; - } - final IPath fromOSString = Path.fromOSString(fileInfo.getLocation()); - return FileLocator.find(bundle, fromOSString, null); - } - - - /* - * Returns property resource bundle if it exists. May return null. - * This implementation assumes that the basename of the bundle is the same - * as the source file name and in the same directory. - * - */ - public ResourceBundle getResourceBundle() throws IOException, MalformedURLException { - if (resourceBundle == null){ - URL bundleURL = getStandardMetaDataSourceFileBasenameURL(); - if (bundleURL == null) - return null; - - resourceBundle = ResourceBundleHelper.getResourceBundle(bundleURL); - } - return resourceBundle; - } - - private URL getStandardMetaDataSourceFileBasenameURL() { - IPath annotationPath = Path.fromOSString(fileInfo.getLocation()); - IPath annotationFolder = annotationPath.removeLastSegments(1); - IPath propertiesLocation = annotationPath.removeFirstSegments(annotationPath.segmentCount() - 1).removeFileExtension(); - // append location of properties file - IPath propertiesFile = annotationFolder.append(propertiesLocation); - - // append .properties extension if needed - if (propertiesFile.getFileExtension() == null) - propertiesFile = propertiesFile.addFileExtension("properties"); //$NON-NLS-1$ - // create a URL out of the properties file location - return FileLocator.find(Platform.getBundle(fileInfo.getBundleId()), - propertiesFile, null); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ResourceBundleHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ResourceBundleHelper.java deleted file mode 100644 index fc55894db..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/ResourceBundleHelper.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM 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: - * IBM Corporation - initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Gerry Kessler/Oracle - copied from org.eclipse.wst.sse.core.internal.encoding.util and modified heavily - *******************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Locale; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * ResourceBundleHelper - * - */ -public final class ResourceBundleHelper { - - /** - * @param resourceURL - * @return ResourceBundle - * @throws MalformedURLException - may return null - * @throws IOException - */ - public static ResourceBundle getResourceBundle(final URL resourceURL) throws MalformedURLException, IOException { - return getResourceBundle(resourceURL, Locale.getDefault()); - } - - /** - * @param resourceURL - * @param targetLocale - * @return ResourceBundle - may return null - * @throws MalformedURLException - * @throws IOException - */ - public static ResourceBundle getResourceBundle(final URL resourceURL, final Locale targetLocale) throws MalformedURLException, IOException { - // try to load bundle from the location specified in the resourceURL - // - final String protocol = resourceURL.getProtocol(); - final String host = resourceURL.getHost(); - final String file = resourceURL.getFile(); - final IPath path = new Path(file); - - String dir = "./"; //$NON-NLS-1$ - final String bundleName = path.removeFileExtension().segment(path.segmentCount() - 1); - if (path.segmentCount() > 1) - { - dir = path.removeLastSegments(1).toString(); - } - - // create a class loader with a class path that points to the resource - // bundle's location - // - final URL[] classpath = new URL[1]; - classpath[0] = FileLocator.resolve(new URL(protocol, host, dir)); - // TODO: does this need to be in a doPrivileged block? - final ClassLoader resourceLoader = new URLClassLoader(classpath, null); - - return ResourceBundle.getBundle(bundleName, targetLocale, resourceLoader); - } - - private ResourceBundleHelper() - { - // no instantiation - } -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileInfo.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileInfo.java deleted file mode 100644 index 25cc1c208..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileInfo.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -/** - * Contains information about annotation files. - */ -public final class StandardMetaDataFileInfo implements IStandardMetaDataSourceInfo{ - - private final String fileLocation; - private final String fileLocatorClassname; - private final String bundleId; - - /** - * Constructor - * @param fileLocation - * @param bundleId - * @param fileLocatorClassname - */ - public StandardMetaDataFileInfo( String fileLocation, String bundleId, String fileLocatorClassname) { - this.fileLocation = fileLocation.trim(); - this.bundleId = bundleId.trim(); - this.fileLocatorClassname = fileLocatorClassname; - } - - /** - * Get the location of the annotation file as originally specified. - * - * @return String - */ - public String getLocation() { - return fileLocation; - } - - /** - * Get the annotation file locator classname that must implement ICMAnnotationSourceFileLocator. - * Can return null or empty string. Caller should provide default. - * - * @return String - */ - public String getLocatorClassname() { - return fileLocatorClassname != null ? fileLocatorClassname.trim() : null; - } - - /** - * Get the bundle id of the plugin where the annotation file is located. - * - * @return String - */ - public String getBundleId() { - return bundleId; - } - - public String toString(){ - StringBuffer buf = new StringBuffer("StandardMetaDataFileInfo"); //$NON-NLS-1$ - buf.append(": "); //$NON-NLS-1$ - buf.append(bundleId); - buf.append("/"); //$NON-NLS-1$ - buf.append(fileLocation); - if (getLocatorClassname() != null){ - buf.append(": "); //$NON-NLS-1$ - buf.append(getLocatorClassname()); - } - return buf.toString(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java deleted file mode 100644 index 11d87e9c6..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java +++ /dev/null @@ -1,311 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006, 2007 IBM 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: - * IBM - Initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Gerry Kessler/Oracle - code borrowed and repurposed for JSF subproject - * - *******************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper; - - -/** - * Registry of standard metadata files - */ -public final class StandardMetaDataFileRegistry { - private Map/*<String, List<IMetaDataSourceModelProvider>>*/ mdFilesMap = new HashMap/*<String, List<IMetaDataSourceModelProvider>>*/(1); - private List/*<IMetaDataSourceModelProvider>*/ EMPTY_LIST = new ArrayList/*<IMetaDataSourceModelProvider>*/(0); - - private static StandardMetaDataFileRegistry reg; - - /** - * @return the singleton instance of the registry - */ - public static StandardMetaDataFileRegistry getInstance() { - if (reg == null){ - reg = new StandardMetaDataFileRegistry(); - } - return reg; - } - - private StandardMetaDataFileRegistry() { - new StandardMetaDataFileRegistryReader(this).readRegistry(); - } - - /** - * @param uri as String - * @return list of standard metadata sources as <code>IMetaDataSourceModelProvider</code>s. - * Returns empty list of no standard metadata files are registered for the given uri. - */ - public synchronized List/*<IMetaDataSourceModelProvider>*/ getStandardMetaDataModelProviders(String uri) { - List/*<IMetaDataSourceModelProvider>*/ theList = (List)mdFilesMap.get(uri); - return theList != null ? theList : EMPTY_LIST ; - } - - /** - * For use by registry reader only - * @param uri - * @param fileInfo - */ - public synchronized void addStandardMetaDataFileInfo(String uri, IStandardMetaDataSourceInfo fileInfo) { - List/*<IMetaDataSourceModelProvider>*/ providers = (List) mdFilesMap.get(uri); - if (providers == null) { - providers = new ArrayList/*<IStandardMetaDataSourceInfo>*/(); - mdFilesMap.put(uri, providers); - } - providers.add(new StandardMetaDataFilesProvider(fileInfo)); - } - -/** - * Internal implementation of IMetaDataSourceModelProvider for "standard" metadata sources - * - */ -static class StandardMetaDataFilesProvider implements IMetaDataSourceModelProvider { - - private org.eclipse.jst.jsf.common.metadata.internal.IStandardMetaDataSourceInfo info; - private Object model; - private IMetaDataLocator locator; - private StandardMetaDataSourceFileLocator fileLocator = null; - - /** - * Constructor - * @param info - */ - StandardMetaDataFilesProvider(IStandardMetaDataSourceInfo info){ - this.info = info; - } - - private StandardMetaDataSourceFileLocator getFileLocator(){ - if (fileLocator == null){ - if (info.getLocatorClassname() == null){ - fileLocator = new PluginRelativeStandardMetaDataSourceFileLocator(); - } - else { - Class klass = JSFCommonPlugin.loadClass(info.getLocatorClassname(), info.getBundleId()); - try { - fileLocator = (StandardMetaDataSourceFileLocator)klass.newInstance(); - } catch (InstantiationException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InstantiationException: StandardMetaDataFilesProvider.getFileLocator()", e); //$NON-NLS-1$ - } catch (IllegalAccessException e) { - JSFCommonPlugin.log(IStatus.ERROR, "IllegalAccessException: StandardMetaDataFilesProvider.getFileLocator()", e); //$NON-NLS-1$ - } - } - if (fileLocator != null) - fileLocator.setFileInfo(info); - } - return fileLocator; - } - - private InputStream getInputStream() throws IOException { - if (getFileLocator() != null){ - return getFileLocator().getInputStream(); - } - return null; - - } - - private URI getMDFileURI() - { - try - { - StandardMetaDataSourceFileLocator fileLocator2 = getFileLocator(); - if (fileLocator2 != null) - { - final URL url = fileLocator2.getURL(); - if (url == null) - { - JSFCommonPlugin.log(new RuntimeException(), - "Couldn't locate meta-data file for " //$NON-NLS-1$ - + fileLocator2.getFileInfo() - .getLocation()); - return null; - } - - java.net.URI uri = url.toURI(); - return URI.createURI(uri.toString()); - } - } - catch (URISyntaxException e) - { - JSFCommonPlugin.log(IStatus.ERROR, "Metadata File Load Error: " //$NON-NLS-1$ - + getFileLocator().getFileInfo().toString() - + ": URISyntaxException: " + e.getMessage()); //$NON-NLS-1$ - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#getSourceModel() - */ - public Object getSourceModel() { - if (model != null) - return model; - - InputStream inputStream = null; - try { - URI uri = getMDFileURI(); - inputStream = getInputStream(); - if (inputStream != null && uri != null){ - EList contents = StandardModelFactory.getInstance().loadStandardFileResource(inputStream, this, uri); - //check to see if this is a Model - if (contents != null && !contents.isEmpty() && - contents.get(0) instanceof Model){ - model = contents.get(0); - ((Model)model).setSourceModelProvider(this); - } - } - } catch (FileNotFoundException e){ - JSFCommonPlugin.log(IStatus.ERROR, e.getLocalizedMessage()); - } catch (IOException e) { - JSFCommonPlugin.log(IStatus.ERROR,"IOException(1): StandardMetaDataFilesProvider.getSourceModel():"+getModelName(), e); //$NON-NLS-1$ - } finally { - if (inputStream != null){ - try { - inputStream.close(); - } catch (IOException e) { - JSFCommonPlugin.log( IStatus.ERROR,"IOException (2): StandardMetaDataFilesProvider.getSourceModel():"+getModelName(), e); //$NON-NLS-1$ - } - } - } - return model; - } - - private String getModelName() { - return info.toString(); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#getLocator() - */ - public IMetaDataLocator getLocator() { - return locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#setLocator(org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator) - */ - public void setLocator(IMetaDataLocator locator) { - this.locator = locator; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider#getResourceBundle() - */ - private ResourceBundle internalGetResourceBundle() { - if (getFileLocator() != null){ - try { - return fileLocator.getResourceBundle(); - } catch (MissingResourceException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InternalGetResourceBundle1", e); //$NON-NLS-1$ - } catch (IOException e) { - JSFCommonPlugin.log(IStatus.ERROR, "InternalGetResourceBundle2", e); //$NON-NLS-1$ - } - } - return null; - } - - public Object getAdapter(Class klass) { - final StandardMetaDataFilesProvider mdp = this; - if (klass == IImageDescriptorProvider.class){ - return new IImageDescriptorProvider(){ - String imageBase; - public ImageDescriptor getImageDescriptor(String imagePath) { - imagePath = appendImageBase(imagePath); - String bundleID = mdp.getFileLocator().getFileInfo().getBundleId(); - URL url = FileLocator.find(Platform.getBundle(bundleID), new Path(imagePath), null); - return ImageDescriptor.createFromURL(url); - } - private String appendImageBase(String imagePath) { - return getImageBase() + imagePath; - } - - private String getImageBase(){ - if (imageBase == null){ - Model aModel = (Model)getSourceModel(); - Trait t = TaglibDomainMetaDataQueryHelper.getTrait(aModel, "images-base-path"); //$NON-NLS-1$ - if (t == null){ - imageBase = ""; //$NON-NLS-1$ - } else { - imageBase = TraitValueHelper.getValueAsString(t); - if (imageBase != null && imageBase.length() > 0){ - imageBase = imageBase +"/"; //$NON-NLS-1$ - } - } - } - return imageBase; - } - - }; - - } else if (klass == IResourceBundleProvider.class) { - return new IResourceBundleProvider(){ - - public ResourceBundle getResourceBundle() { - return mdp.internalGetResourceBundle(); - } - - }; - - } else if (klass == IClassLoaderProvider.class){ - return new IClassLoaderProvider(){ - - public Class loadClass(String className) { - String bundleID = mdp.getFileLocator().getFileInfo().getBundleId(); - try { - return Platform.getBundle(bundleID).loadClass(className); - } catch (ClassNotFoundException e) { - return null; - } - } - - }; - } else if (klass == IResourceURLProvider.class) { - return new IResourceURLProvider() { - - public URL getResourceURL(String resourcePath) { - URL resourceURL = null; - String bundleID = mdp.getFileLocator().getFileInfo().getBundleId(); - try { - resourceURL = FileLocator.resolve(Platform.getBundle(bundleID).getResource(resourcePath)); - } catch (IOException ioe) { - //do nothing, will return null resourceURL - } - return resourceURL; - } - - }; - } - return null; - } - -} -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistryReader.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistryReader.java deleted file mode 100644 index 802481b3c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistryReader.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2006, 2007 IBM 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: - * IBM - Initial API and implementation - * Jens Lukowski/Innoopract - initial renaming/restructuring - * Gerry Kessler/Oracle - code borrowed and repurposed for JSF subproject - * - *******************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; - - -/** - * This class reads the standardMetaDataFiles extensions adds each specified standard metadata - * file to the StandardMetaDataFileRegistry. - * - * @see StandardMetaDataFileRegistry - * also see StandardMetaDataFile extension-point - */ -public class StandardMetaDataFileRegistryReader { - /** - * EXTENSION POINT ID - */ - protected static final String EXTENSION_POINT_ID = "standardMetaDataFiles"; //$NON-NLS-1$ - /** - * IConfigurationElement element name - */ - protected static final String TAG_NAME = "StandardMetaDataFile"; //$NON-NLS-1$ - /** - * Uri attribute name for IConfigurationElement - */ - protected static final String ATT_URI = "uri"; //$NON-NLS-1$ - /** - * Location attribute name for IConfigurationElement - */ - protected static final String ATT_LOCATION = "location"; //$NON-NLS-1$ - /** - * Locator attribute name for IConfigurationElement - */ - protected static final String ATT_LOCATOR = "locator"; //$NON-NLS-1$ - - private StandardMetaDataFileRegistry annotationFileRegistry; - - /** - * Constructor - * @param registry - */ - public StandardMetaDataFileRegistryReader(StandardMetaDataFileRegistry registry) { - this.annotationFileRegistry = registry; - } - - /** - * read the registery - */ - public void readRegistry() { - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = extensionRegistry.getExtensionPoint(JSFCommonPlugin.PLUGIN_ID, EXTENSION_POINT_ID); - if (point != null) { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) { - readElement(elements[i]); - } - } - } - - private void readElement(IConfigurationElement element) { - if (element.getName().equalsIgnoreCase(TAG_NAME)) { - String uri = element.getAttribute(ATT_URI); - String location = element.getAttribute(ATT_LOCATION); - String locator = element.getAttribute(ATT_LOCATOR); - String bundleId = null; - if (uri != null && location != null) { - try { - bundleId = element.getContributor().getName(); - StandardMetaDataFileInfo fileInfo = new StandardMetaDataFileInfo(location, bundleId, locator); - annotationFileRegistry.addStandardMetaDataFileInfo(uri, fileInfo); - } - catch (Exception e) { - JSFCommonPlugin.log(IStatus.ERROR, "Internal Error: exception occurred while reading StandardMetaDataFile ext-pt: "+location + ":"+uri, e); //$NON-NLS-1$ //$NON-NLS-2$ } - } - } - } - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFilesTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFilesTranslator.java deleted file mode 100644 index 6695ec5a1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFilesTranslator.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.Iterator; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.util.EcoreUtil.Copier; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.StandardMetaDataFileRegistry.StandardMetaDataFilesProvider; - - -/** - * A 'null' translation of a metadata file. Entities and traits are not transformed. - * - */ -public class StandardMetaDataFilesTranslator implements IMetaDataTranslator { - - public boolean canTranslate(final IMetaDataSourceModelProvider modelProvider) { - if (modelProvider instanceof StandardMetaDataFilesProvider) - return true; - return false; - } - - public void translate(final IMetaDataModelMergeAssistant assistant) {//TODO: throw proper errors - //null translate - sourceModel object are already Entities and traits - //traverse the tree and add to model - - //temp - throw proper errors - //assert assistant.getSourceModel() instanceof ModelKeyDescriptor; - - final MetaDataModel mm = assistant.getMergedModel(); - final Model mk = (Model)assistant.getSourceModelProvider().getSourceModel(); - if (mm.getRoot() == null) { - //create copy, otherwise source model becomes merged model because of reference - final Copier copier = new Copier(); - final Model newModel = (Model)copier.copy(mk.getModel()); - copier.copyReferences(); - mm.setRoot(newModel); - } - else { - //for each entity and trait call "add". assistant will handle merge. - if (mk != null) {//possible that model was not loaded - traverseAndAdd(assistant, mk); - } else if (StandardModelFactory.DEBUG_MD_LOAD) { - JSFCommonPlugin.log(IStatus.ERROR,"Unable to load source model: "+assistant.getSourceModelProvider()); //$NON-NLS-1$ - } - } - } - - /** - * Add entity and any children - * @param assistant - * @param entity - */ - protected void traverseAndAdd(final IMetaDataModelMergeAssistant assistant, final Entity entity){ - final Entity mmEntity = assistant.addEntity(entity); - - if (entity instanceof Model){ - final Model model = (Model)entity; - for (final Iterator/*EntityGroup*/ it=model.getEntityGroups().iterator();it.hasNext();){ - assistant.addEntityGroup((EntityGroup)it.next()); - } - } - - for (final Iterator/*<Trait>*/ it=entity.getTraits().iterator();it.hasNext();){ - final Trait trait = (Trait)it.next(); - assistant.addTrait(mmEntity, trait); - } - - for (final Iterator/*<EntityKey>*/ it=entity.getChildEntities().iterator();it.hasNext();){ - final Entity e = (Entity)it.next(); - traverseAndAdd(assistant, e); - } - - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataLocator.java deleted file mode 100644 index fd3e3ea4a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataLocator.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.List; - - -/** - * Implementation of IMetaDataLocator for standard metadata sources. - * Uses StandardMetaDataFileRegistry to locate instances. - * - */ -public class StandardMetaDataLocator extends AbstractMetaDataLocator { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.internal.IMetaDataLocator#locateMetaDataModelProviders(java.lang.String) - */ - public List locateMetaDataModelProviders(String uri) { - return StandardMetaDataFileRegistry.getInstance().getStandardMetaDataModelProviders(uri); - } - - /* - * Does nothing. - */ - public void startLocating() { - //do nothing - } - - /* - * Does nothing. - */ - public void stopLocating() { - //do nothing - } - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java deleted file mode 100644 index e65d0dab2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java +++ /dev/null @@ -1,74 +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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - - -/** - * Used to supply an InputStream to the parser of an annotation - * meta-data file and the URL to the resource bundle for a properties file, if any. - * - * Implementors must provide a zero-argument constructor. - * - * CURRENTLY INTERNAL... WILL BE MADE API AT SOME POINT - * - */ -public abstract class StandardMetaDataSourceFileLocator { - /** - * metadata file to locate - */ - protected IStandardMetaDataSourceInfo fileInfo; - - /** - * Set the <code>IStandardMetaDataSourceInfo</code> for this locator - * @param fileInfo - */ - public final void setFileInfo(IStandardMetaDataSourceInfo fileInfo){ - this.fileInfo = fileInfo; - } - - /** - * @return the <code>IStandardMetaDataSourceInfo</code> for this locator - */ - protected final IStandardMetaDataSourceInfo getFileInfo(){ - return fileInfo; - } - /** - * Return InputStream to the meta-data source file. - * Callers are responsible for closing the stream. - * @return InputStream - * @throws IOException - */ - public abstract InputStream getInputStream() throws IOException; - - /** - * Return URL to the meta-data source file. - - * @return URL or null if cannot find a the file for getFileInfo - */ - public abstract URL getURL(); - - /** - * Return ResourceBundle for the property files if there are any. Return null if not. - * - * @return java.util.ResourceBundle - * @throws IOException - * @throws MissingResourceException - */ - public abstract ResourceBundle getResourceBundle() throws IOException, MissingResourceException; -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardModelFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardModelFactory.java deleted file mode 100644 index e0574f61e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardModelFactory.java +++ /dev/null @@ -1,293 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.BasicExtendedMetaData; -import org.eclipse.emf.ecore.util.ExtendedMetaData; -import org.eclipse.emf.ecore.xmi.ClassNotFoundException; -import org.eclipse.emf.ecore.xmi.FeatureNotFoundException; -import org.eclipse.emf.ecore.xmi.IllegalValueException; -import org.eclipse.emf.ecore.xmi.PackageNotFoundException; -import org.eclipse.emf.ecore.xmi.UnresolvedReferenceException; -import org.eclipse.emf.ecore.xmi.XMIException; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.internal.util.MetadataResourceImpl; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; - -/** - * Singleton that produces and loads standard metadata models. - * All models are loaded into the same ResourceSet. - * <p> - * All metadata extension models must be registered with org.eclipse.emf.ecore.generated_package extension-point. - * No other mechanism is provided for model uri resolution. - * <p> - * Debug tracing for model loading is available: <code>org.eclipse.jst.jsf.common/debug/metadataload=true</code> - * <p> - * When the /debug/metadataload trace flag is set, and in case extension models are known not to be available, - * and metadata is referencing those models, error logging can be suppressed by launching with the following properties set:<br> - * metadata.package.ignores<br> - * metadata.classname.ignores - * <p> - * eg. Usage for when WPE is not present<p> - * <code> - -Dmetadata.package.ignores=http://org.eclipse.jsf.pagedesigner/dtinfo.ecore,<br>http://org.eclipse.jsf.pagedesigner/QuickEditTabSections.ecore<br> - -Dmetadata.classname.ignores=DTInfo,QuickEditTabSections<br> - * </code> - * <p> - * see {@link Model} - */ -public class StandardModelFactory { - private static StandardModelFactory INSTANCE; - static boolean DEBUG_MD_LOAD = false; - static boolean DEBUG_MD_GET = false; - private ExtendedMetaData extendedMetaData; - private ResourceSet resourceSet; - - - /** - * @return singleton instance of the metadata model factory - */ - public synchronized static StandardModelFactory getInstance(){ - if (INSTANCE == null){ - INSTANCE = new StandardModelFactory(); - INSTANCE.init(); - - if (JSFCommonPlugin.getPlugin().isDebugging()){ - DEBUG_MD_LOAD = Boolean.valueOf(Platform.getDebugOption(JSFCommonPlugin.PLUGIN_ID+"/debug/metadataload")).booleanValue();//$NON-NLS-1$ - DEBUG_MD_GET = Boolean.valueOf(Platform.getDebugOption(JSFCommonPlugin.PLUGIN_ID+"/debug/metadataget")).booleanValue();//$NON-NLS-1$ - } - } - return INSTANCE; - } - - private void init() { - resourceSet = new ResourceSetImpl(); - - extendedMetaData = new BasicExtendedMetaData(resourceSet.getPackageRegistry()); - - // Register the appropriate resource factory to handle all file extensions. - // - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put - (Resource.Factory.Registry.DEFAULT_EXTENSION, - new XMLResourceFactoryImpl()); - - //relying on the org.eclipse.emf.ecore.generated_package ext-pt to register traits - } - - private StandardModelFactory() { - super(); - } - - /** - * Factory method that probably belongs somewhere else! - * @param key - * @param strategy - * @return an empty MetaDataModel - */ - public MetaDataModel createModel(ModelKeyDescriptor key, IDomainLoadingStrategy strategy){ - return new MetaDataModel(key, strategy); - } - - /** - * Factory method that probably belongs somewhere else! - * @param modelContext - * @return a ModelKeyDescriptor for the context - */ - public ModelKeyDescriptor createModelKeyDescriptor(final ITaglibDomainMetaDataModelContext modelContext) { - return new ModelKeyDescriptor(modelContext.getProject(), modelContext.getDomainID(), modelContext.getURI()); - } - - /** - * @param inputStream - * @param provider - * @param uri - * @return the root of the standard model from the resource as an EList - * @throws IOException - */ - public EList loadStandardFileResource(final InputStream inputStream, - final IMetaDataSourceModelProvider provider, - final org.eclipse.emf.common.util.URI uri) throws IOException - { - final XMLResource res = new MetadataResourceImpl(provider); - - debug(String.format( - ">>> Loading standard meta-data file for uri %s", uri), DEBUG_MD_LOAD); //$NON-NLS-1$ - - res.setURI(uri); - resourceSet.getResources().add(res); - setLoadOptions(res); - res.load(inputStream, null); - if (DEBUG_MD_LOAD) - { - reportErrors(res); - } - final EList root = res.getContents(); - return root; - } - - private void reportErrors(Resource res) { - EList<Resource.Diagnostic> errs = res.getErrors(); - if (! errs.isEmpty()){ - for (Iterator<Resource.Diagnostic> it= errs.iterator();it.hasNext();){ - StandardModelErrorMessageFactory.logErrorMessage(it.next()); - } - } - } - - /** - * Sets default load options for the resource - * @param resource - */ - protected void setLoadOptions(XMLResource resource) { - Map options = resource.getDefaultLoadOptions(); -// options.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, true); - options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - options.put(XMLResource.OPTION_EXTENDED_META_DATA, extendedMetaData); - options.put(XMLResource.OPTION_RESOURCE_HANDLER, resource); - options.put(XMLResource.OPTION_LAX_FEATURE_PROCESSING, Boolean.TRUE); - options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.FALSE);//turning this off so that res.getErrors() has values to check! bizarre that I should need to do this. -// options.put(XMLResource.OPTION_DOM_USE_NAMESPACES_IN_SCOPE, Boolean.TRUE); - -// if (DEBUG_MD_LOAD) -// { -// System.out.println("Using load options: "+options); -// } - } - - - static class StandardModelErrorMessageFactory { - private static List<String> _missingPackageURIs; - private static List<String> _missingClassnames; - - /** - * Simply logs all messages against JSFCommonPlugin, for now. - * @param diagnostic - */ - public static void logErrorMessage(Resource.Diagnostic diagnostic) { - //should be XMIException - if (diagnostic instanceof XMIException) { - XMIException ex = (XMIException)diagnostic; - String msg = createMessage(ex); - if (msg != null) - JSFCommonPlugin.log(IStatus.ERROR, msg); - } - else { - JSFCommonPlugin.log(IStatus.ERROR, diagnostic.toString());//do better??? - } - } - - private static String createMessage(XMIException ex) { - - StringBuffer buf = new StringBuffer("Metadata Load Error: ") //$NON-NLS-1$ - .append(ex.getClass().getSimpleName()).append(": "); //$NON-NLS-1$ - - if (ex instanceof PackageNotFoundException) { - if (shouldIgnore(ex)) - return null; - - buf.append(((PackageNotFoundException)ex).uri()); - } - else if (ex instanceof ClassNotFoundException) { - if (shouldIgnore(ex)) - return null; - - buf.append(((ClassNotFoundException)ex).getName()); - } - else if (ex instanceof FeatureNotFoundException) - buf.append(((FeatureNotFoundException)ex).getName()); - else if (ex instanceof IllegalValueException) - buf.append(((IllegalValueException)ex).getValue().toString()); - else if (ex instanceof UnresolvedReferenceException) - buf.append(((UnresolvedReferenceException)ex).getReference()); - else - buf.append(ex.getMessage()); - - buf.append(" in ").append(ex.getLocation()).append(": Line = ") //$NON-NLS-1$ //$NON-NLS-2$ - .append(ex.getLine()).append(": Column = ").append(ex.getColumn()); //$NON-NLS-1$ - return buf.toString(); - } - - private static boolean shouldIgnore(XMIException ex) { - if (ex instanceof PackageNotFoundException) { - String uri = ((PackageNotFoundException)ex).uri(); - return getMissingPackageURIs().contains(uri); - } - else if (ex instanceof ClassNotFoundException) { - String className = ((ClassNotFoundException)ex).getName(); - return getMissingClassnames().contains(className); - } - return false; - } - - private static List<String> getMissingPackageURIs() { - if (_missingPackageURIs == null) { - _missingPackageURIs = buildList("metadata.package.ignores"); //$NON-NLS-1$ - - } - return _missingPackageURIs; - } - - private static List<String> getMissingClassnames() { - if (_missingClassnames == null) { - _missingClassnames = buildList("metadata.classname.ignores"); //$NON-NLS-1$ - } - return _missingClassnames; - } - - private static List<String> buildList(String propertyName) { - List<String> ret = new ArrayList<String>(); - String ignoreSet = System.getProperty(propertyName); - if (ignoreSet == null )//try env - ignoreSet = System.getenv(propertyName); - - if (ignoreSet != null && !(ignoreSet.equals(""))){ //$NON-NLS-1$ - StringTokenizer st = new StringTokenizer(ignoreSet, ","); //$NON-NLS-1$ - while(st.hasMoreTokens()){ - String uri = st.nextToken(); - if (!(uri.equals(""))) //$NON-NLS-1$ - ret.add(uri); - } - } - - return ret; - } - - } - - /** - * Debug output. The parenthesis shows thread id. - * @param msg - * @param debugFlag - */ - public static void debug(String msg, boolean debugFlag) { - if (debugFlag) - System.out.println(msg + "["+Thread.currentThread().getId()+"]"); //$NON-NLS-1$ //$NON-NLS-2$ - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TaglibDomainMetaDataModelContextImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TaglibDomainMetaDataModelContextImpl.java deleted file mode 100644 index 040c5069d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TaglibDomainMetaDataModelContextImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext; - -/** - * Simple implementation of {@link ITaglibDomainMetaDataModelContext} - */ -public class TaglibDomainMetaDataModelContextImpl extends MetaDataModelContextImpl implements ITaglibDomainMetaDataModelContext, Cloneable -{ - private final IProject _project; - private final String _uri; - - /** - * Constructor - * @param project - * @param domain - * @param uri - */ - public TaglibDomainMetaDataModelContextImpl(final String domain, final IProject project, final String uri){ - super(domain); - this._project = project; - this._uri = uri; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext#getProject() - */ - public IProject getProject() { - return _project; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITaglibDomainMetaDataModelContext#getURI() - */ - public String getURI() { - return _uri; - } - - public Object getAdapter(Class adapter) { - if (adapter.equals(ITaglibDomainMetaDataModelContext.class)) - return this; - - return super.getAdapter(adapter); - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper.java deleted file mode 100644 index a0812fe9e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/TraitValueHelper.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.BasicEObjectImpl; -import org.eclipse.emf.ecore.util.FeatureMap; -import org.eclipse.emf.ecore.xml.type.AnyType; -import org.eclipse.emf.ecore.xml.type.SimpleAnyType; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.osgi.util.NLS; - -/** - * Experimental/prototype class to assist with decoding trait values. - * This could/should be made API at some point after "hardening". (https://bugs.eclipse.org/bugs/show_bug.cgi?id=192052) - */ -public class TraitValueHelper { - private static final String KEY_NOT_FOUND = Messages.Key_not_found; - /** - * @param trait - * @return EClass of trait value - */ - public static EClass getValueType(final Trait trait){ - if (trait == null) - return null; - if (trait.getValue() != null) - return trait.getValue().eClass(); - return null; - } - - /** - * @param trait - * @return value of trait as String Object. - */ - public static Object getValue(final Trait trait){ - if (trait == null) - return null; - - if (trait.getValue() == null) - return null; - - if (trait.getValue() instanceof StringValue) { - return ((StringValue)trait.getValue()).getValue(); - } - else if (trait.getValue() instanceof SimpleAnyType){ - return ((SimpleAnyType)trait.getValue()).getRawValue(); - } - else if (trait.getValue() instanceof AnyType){ - AnyType any = (AnyType)trait.getValue(); - FeatureMap map = any.getMixed(); - return getTextValueFromFeatureMap(map); - } - else if ( trait.getValue().eIsProxy() && trait.getValue() instanceof BasicEObjectImpl){ - BasicEObjectImpl o = (BasicEObjectImpl)trait.getValue(); - return o.eProxyURI().toString(); - } - return trait.getValue(); - } - - private static String getTextValueFromFeatureMap(final FeatureMap map) { - for (final Iterator it=map.iterator();it.hasNext();){ - final FeatureMap.Entry entry = (FeatureMap.Entry)it.next(); - if (entry.getEStructuralFeature().getName().equals("text")) //$NON-NLS-1$ - return (String)entry.getValue(); - } - return null; - } - - /** - * @param trait - * @return value of trait as String. If externalized, will resolve from resource bundle. - */ - public static String getValueAsString(final Trait trait){ - final Object val = getValue(trait); - if (val instanceof String){ - return getNLSValue(trait, (String)val); - } - else if (val instanceof BooleanValue) - return String.valueOf(((BooleanValue)val).isTrue()); - - return null; - } - - /** - * - * @param trait whose value a {@link ListOfValues} or is a single string - * @return List of Strings. If externalized, will resolve from resource bundle - * using getNLSValue(Trait trait, String rawValue) - */ - public synchronized static List getValueAsListOfStrings(final Trait trait){ - //PROTO ONLY!!! Need to make WAY more robust! - final List ret = new ArrayList(); - if (trait.getValue() instanceof ListOfValues) { - for(final Iterator it=trait.getValue().eContents().iterator();it.hasNext();){ - final Object o = it.next(); - if (o instanceof SimpleAnyType){ - final SimpleAnyType sat = (SimpleAnyType)o; - final String rawValue = getTextValueFromFeatureMap(sat.getMixed()); - final String nlsValue = getNLSValue(trait, rawValue); - - ret.add(nlsValue); - } - } - } - else { - //may be single value - String o = getValueAsString(trait); - if (o != null) - ret.add(o); - } - return ret; - } - - /** - * Looks for '%' (and not '%%') at beginning of rawValue. If found, looks to the - * traits sourceModelProvider for resource bundle to resolve the key after - * stripping the '%' sign. - * @param trait - * @param rawValue of string in from metadata - * @return the NLS Value or rawValue if it cannot be located - */ - public static String getNLSValue(final Trait trait, final String rawValue) { - String result = rawValue; - if (rawValue.startsWith("%") && !rawValue.startsWith("%%")){ //$NON-NLS-1$//$NON-NLS-2$ - final String key = rawValue.substring(1); - result = getNLSPropertyValue(trait, key); - if (result == null){ - result = rawValue; - } - } - return result == null ? null : result.trim(); - } - - //will return null if there is an IOException with ResourceBundle - private static String getNLSPropertyValue(final Trait trait, final String key){ - try{ - IMetaDataSourceModelProvider provider = trait.getSourceModelProvider(); - IResourceBundleProvider resourceBundleProvider = (IResourceBundleProvider)provider.getAdapter(IResourceBundleProvider.class); - if (resourceBundleProvider != null){ - ResourceBundle resourceBundle_ = resourceBundleProvider.getResourceBundle(); - if (resourceBundle_ != null){ - String replVal = resourceBundle_.getString(key); - return replVal; - } - } - //return original string - return key; - - } catch (MissingResourceException e){ - //fall thru - JSFCommonPlugin.log(e, NLS.bind(Messages.MissingResource_exception, new String[]{key})); - } - return key + KEY_NOT_FOUND; - } - - /** - * If trait type is {@link BooleanValue} returns value, otherwise - * it will get the value as a String and attempt to coerce to boolean. - * Will return 'false' if coercion fails, or value was null. - * @param trait - * @return true or false - */ - public static boolean getValueAsBoolean(final Trait trait) { - if (trait != null && trait.getValue() instanceof BooleanValue) { - return ((BooleanValue)trait.getValue()).isTrue(); - } - final String val = getValueAsString(trait); - if (val == null) - return false; - - return Boolean.valueOf(val).booleanValue(); - } - -// /** -// * @param trait -// * @return name of class or primitive datatype that the value is defined as. -// * For SimpleAnyTypes, the getInstanceType().getInstanceClassName() is returned. -// * For AnyType, java.lang.String is always returned. -// * For all others, the class.getName() is returned. -// */ -// public static String getValueInstanceClassName(Trait trait) {String.class.getName(); -// if (trait.getValue() instanceof SimpleAnyType) { -// return ((SimpleAnyType)trait.getValue()).getInstanceType().getInstanceClassName(); -// } -// else if (trait.getValue() instanceof AnyType) { -// return String.class.getName(); -// } -// else { -// return trait.getValue().getClass().getName(); -// } -// -// } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityGroupImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityGroupImpl.java deleted file mode 100644 index eb8ef8b2d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityGroupImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: EntityGroupImpl.java,v 1.6 2008/11/18 22:24:39 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Entity Group</b></em>'. - * <!-- end-user-doc --> - * <p> - * </p> - * - * @generated - */ -@SuppressWarnings("hiding") -public class EntityGroupImpl extends EntityImpl implements EntityGroup { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EntityGroupImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return MetadataPackage.Literals.ENTITY_GROUP; - } - -} //EntityGroupImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityImpl.java deleted file mode 100644 index ab8247dab..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/EntityImpl.java +++ /dev/null @@ -1,432 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: EntityImpl.java,v 1.8 2010/01/27 23:54:32 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; -import org.eclipse.jst.jsf.common.metadata.query.internal.IHierarchicalEntityVisitor; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Entity</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getChildEntities <em>Child Entities</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getTraits <em>Traits</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getType <em>Type</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.EntityImpl#getIncludeGroups <em>Include Groups</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class EntityImpl extends EObjectImpl implements Entity { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getChildEntities() <em>Child Entities</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getChildEntities() - * @generated - * @ordered - */ - protected EList childEntities = null; - - /** - * The cached value of the '{@link #getTraits() <em>Traits</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getTraits() - * @generated - * @ordered - */ - protected EList traits = null; - - /** - * The default value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected String id = ID_EDEFAULT; - - /** - * The default value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected static final String TYPE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getType() <em>Type</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getType() - * @generated - * @ordered - */ - protected String type = TYPE_EDEFAULT; - - /** - * The cached value of the '{@link #getIncludeGroups() <em>Include Groups</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getIncludeGroups() - * @generated - * @ordered - */ - protected EList includeGroups = null; - - /** - * The cached value of the Model - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private Model _model; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EntityImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return MetadataPackage.Literals.ENTITY; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getChildEntities() { - if (childEntities == null) { - childEntities = new EObjectContainmentEList(Entity.class, this, MetadataPackage.ENTITY__CHILD_ENTITIES); - } - return childEntities; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getTraits() { - if (traits == null) { - traits = new EObjectContainmentEList(Trait.class, this, MetadataPackage.ENTITY__TRAITS); - } - return traits; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getIncludeGroups() { - if (includeGroups == null) { - includeGroups = new EObjectResolvingEList(IncludeEntityGroup.class, this, MetadataPackage.ENTITY__INCLUDE_GROUPS); - } - return includeGroups; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getId() { - return id; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setId(String newId) { - String oldId = id; - id = newId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.ENTITY__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getType() { - return type; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setType(String newType) { - String oldType = type; - type = newType; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.ENTITY__TYPE, oldType, type)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private boolean accept(final IHierarchicalEntityVisitor visitor) { - if (visitor.visitEnter( this )) { - acceptChildren(visitor); - } - return visitor.visitLeave(this); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void accept(final IEntityVisitor visitor) { - if (visitor instanceof IHierarchicalEntityVisitor) { - accept((IHierarchicalEntityVisitor)visitor); - } - else { - if (visitor.stopVisiting()) - return; - - visitor.visit(this); - if (visitor.stopVisiting()) - return; - - acceptChildren(visitor); - - visitor.visitCompleted(this); - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - private void acceptChildren(final IEntityVisitor visitor) { - if (!getChildEntities().isEmpty()){ - for (final Iterator/*<Entity>*/ it = getChildEntities().iterator(); it.hasNext();){ - final Entity k = (Entity)it.next(); - k.accept(visitor); - if (visitor.stopVisiting()) - return; - } - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public Model getModel() { - if (_model == null){ - EObject parent = this.eContainer(); - while (true){ - if (parent instanceof Model){ - _model = (Model)parent; - break; - } - if (parent != null) - parent = parent.eContainer(); - else - break; - } - } - return _model; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - return ((InternalEList)getChildEntities()).basicRemove(otherEnd, msgs); - case MetadataPackage.ENTITY__TRAITS: - return ((InternalEList)getTraits()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - return getChildEntities(); - case MetadataPackage.ENTITY__TRAITS: - return getTraits(); - case MetadataPackage.ENTITY__ID: - return getId(); - case MetadataPackage.ENTITY__TYPE: - return getType(); - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - return getIncludeGroups(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - getChildEntities().clear(); - getChildEntities().addAll((Collection)newValue); - return; - case MetadataPackage.ENTITY__TRAITS: - getTraits().clear(); - getTraits().addAll((Collection)newValue); - return; - case MetadataPackage.ENTITY__ID: - setId((String)newValue); - return; - case MetadataPackage.ENTITY__TYPE: - setType((String)newValue); - return; - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - getIncludeGroups().clear(); - getIncludeGroups().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - getChildEntities().clear(); - return; - case MetadataPackage.ENTITY__TRAITS: - getTraits().clear(); - return; - case MetadataPackage.ENTITY__ID: - setId(ID_EDEFAULT); - return; - case MetadataPackage.ENTITY__TYPE: - setType(TYPE_EDEFAULT); - return; - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - getIncludeGroups().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.ENTITY__CHILD_ENTITIES: - return childEntities != null && !childEntities.isEmpty(); - case MetadataPackage.ENTITY__TRAITS: - return traits != null && !traits.isEmpty(); - case MetadataPackage.ENTITY__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case MetadataPackage.ENTITY__TYPE: - return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); - case MetadataPackage.ENTITY__INCLUDE_GROUPS: - return includeGroups != null && !includeGroups.isEmpty(); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (id: "); //$NON-NLS-1$ - result.append(id); - result.append(", type: "); //$NON-NLS-1$ - result.append(type); - result.append(')'); - return result.toString(); - } - -} //EntityImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/IncludeEntityGroupImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/IncludeEntityGroupImpl.java deleted file mode 100644 index 3943823c3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/IncludeEntityGroupImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: IncludeEntityGroupImpl.java,v 1.3 2008/11/18 22:24:39 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Include Entity Group</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl#getId <em>Id</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.IncludeEntityGroupImpl#getModelUri <em>Model Uri</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class IncludeEntityGroupImpl extends EObjectImpl implements IncludeEntityGroup { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected String id = ID_EDEFAULT; - - /** - * The default value of the '{@link #getModelUri() <em>Model Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getModelUri() - * @generated - * @ordered - */ - protected static final String MODEL_URI_EDEFAULT = null; - - /** - * The cached value of the '{@link #getModelUri() <em>Model Uri</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getModelUri() - * @generated - * @ordered - */ - protected String modelUri = MODEL_URI_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected IncludeEntityGroupImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return MetadataPackage.Literals.INCLUDE_ENTITY_GROUP; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getId() { - return id; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setId(String newId) { - String oldId = id; - id = newId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.INCLUDE_ENTITY_GROUP__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getModelUri() { - return modelUri; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setModelUri(String newModelUri) { - String oldModelUri = modelUri; - modelUri = newModelUri; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI, oldModelUri, modelUri)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - return getId(); - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - return getModelUri(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - setId((String)newValue); - return; - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - setModelUri((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - setId(ID_EDEFAULT); - return; - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - setModelUri(MODEL_URI_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.INCLUDE_ENTITY_GROUP__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case MetadataPackage.INCLUDE_ENTITY_GROUP__MODEL_URI: - return MODEL_URI_EDEFAULT == null ? modelUri != null : !MODEL_URI_EDEFAULT.equals(modelUri); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (id: "); //$NON-NLS-1$ - result.append(id); - result.append(", modelUri: "); //$NON-NLS-1$ - result.append(modelUri); - result.append(')'); - return result.toString(); - } - -} //IncludeEntityGroupImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataFactoryImpl.java deleted file mode 100644 index b80967ea5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataFactoryImpl.java +++ /dev/null @@ -1,239 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataFactoryImpl.java,v 1.5 2008/11/18 22:24:39 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataFactory; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; - - - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class MetadataFactoryImpl extends EFactoryImpl implements MetadataFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return MetadataFactory - * @generated - */ - public static MetadataFactory init() { - try { - MetadataFactory theMetadataFactory = (MetadataFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.common.metadata/metadata.ecore"); //$NON-NLS-1$ - if (theMetadataFactory != null) { - return theMetadataFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new MetadataFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case MetadataPackage.MODEL: return createModel(); - case MetadataPackage.ENTITY_GROUP: return createEntityGroup(); - case MetadataPackage.ENTITY: return createEntity(); - case MetadataPackage.TRAIT: return createTrait(); - case MetadataPackage.INCLUDE_ENTITY_GROUP: return createIncludeEntityGroup(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object createFromString(EDataType eDataType, String initialValue) { - switch (eDataType.getClassifierID()) { - case MetadataPackage.IMETA_DATA_SOURCE_MODEL_PROVIDER: - return createIMetaDataSourceModelProviderFromString(eDataType, initialValue); - case MetadataPackage.MODEL_CONTEXT: - return createModelContextFromString(eDataType, initialValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String convertToString(EDataType eDataType, Object instanceValue) { - switch (eDataType.getClassifierID()) { - case MetadataPackage.IMETA_DATA_SOURCE_MODEL_PROVIDER: - return convertIMetaDataSourceModelProviderToString(eDataType, instanceValue); - case MetadataPackage.MODEL_CONTEXT: - return convertModelContextToString(eDataType, instanceValue); - default: - throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Trait createTrait() { - TraitImpl trait = new TraitImpl(); - return trait; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IncludeEntityGroup createIncludeEntityGroup() { - IncludeEntityGroupImpl includeEntityGroup = new IncludeEntityGroupImpl(); - return includeEntityGroup; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Model createModel() { - ModelImpl model = new ModelImpl(); - return model; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Entity createEntity() { - EntityImpl entity = new EntityImpl(); - return entity; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EntityGroup createEntityGroup() { - EntityGroupImpl entityGroup = new EntityGroupImpl(); - return entityGroup; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param eDataType IMetaDataSourceModelProvider - * @param initialValue - * @return IMetaDataSourceModelProvider - * @generated - */ - public IMetaDataSourceModelProvider createIMetaDataSourceModelProviderFromString(EDataType eDataType, String initialValue) { - return (IMetaDataSourceModelProvider)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param eDataType - * @param instanceValue - * @return String - * @generated - */ - public String convertIMetaDataSourceModelProviderToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param eDataType - * @param initialValue - * @return ModelKeyDescriptor - * @generated - */ - public ModelKeyDescriptor createModelContextFromString(EDataType eDataType, String initialValue) { - return (ModelKeyDescriptor)super.createFromString(eDataType, initialValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param eDataType - * @param instanceValue - * @return String - * @generated - */ - public String convertModelContextToString(EDataType eDataType, Object instanceValue) { - return super.convertToString(eDataType, instanceValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataPackage getMetadataPackage() { - return (MetadataPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return MetadataPackage - * @deprecated - * @generated - */ - public static MetadataPackage getPackage() { - return MetadataPackage.eINSTANCE; - } - -} //MetadataFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataPackageImpl.java deleted file mode 100644 index 52c73c311..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/MetadataPackageImpl.java +++ /dev/null @@ -1,604 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataPackageImpl.java,v 1.7 2008/11/18 22:24:39 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EDataType; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataFactory; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; -import org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class MetadataPackageImpl extends EPackageImpl implements MetadataPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass traitEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass includeEntityGroupEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass modelEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass entityEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass entityGroupEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iTraitVisitorEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iEntityVisitorEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType iMetaDataSourceModelProviderEDataType = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EDataType modelContextEDataType = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage#eNS_URI - * @see #init() - * @generated - */ - private MetadataPackageImpl() { - super(eNS_URI, MetadataFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return MetadataPackage - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static MetadataPackage init() { - if (isInited) return (MetadataPackage)EPackage.Registry.INSTANCE.getEPackage(MetadataPackage.eNS_URI); - - // Obtain or create and register package - MetadataPackageImpl theMetadataPackage = (MetadataPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof MetadataPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new MetadataPackageImpl()); - - isInited = true; - - // Create package meta-data objects - theMetadataPackage.createPackageContents(); - - // Initialize created meta-data - theMetadataPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theMetadataPackage.freeze(); - - return theMetadataPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getTrait() { - return traitEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getTrait_Value() { - return (EReference)traitEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTrait_SourceModelProvider() { - return (EAttribute)traitEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getIncludeEntityGroup() { - return includeEntityGroupEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIncludeEntityGroup_Id() { - return (EAttribute)includeEntityGroupEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getIncludeEntityGroup_ModelUri() { - return (EAttribute)includeEntityGroupEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getTrait_Id() { - return (EAttribute)traitEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getModel() { - return modelEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getModel_SourceModelProvider() { - return (EAttribute)modelEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getModel_CurrentModelContext() { - return (EAttribute)modelEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getModel_EntityGroups() { - return (EReference)modelEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEntity() { - return entityEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEntity_ChildEntities() { - return (EReference)entityEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEntity_Traits() { - return (EReference)entityEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getEntity_Id() { - return (EAttribute)entityEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getEntity_Type() { - return (EAttribute)entityEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getEntity_IncludeGroups() { - return (EReference)entityEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getEntityGroup() { - return entityGroupEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getITraitVisitor() { - return iTraitVisitorEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getIEntityVisitor() { - return iEntityVisitorEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getIMetaDataSourceModelProvider() { - return iMetaDataSourceModelProviderEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EDataType getModelContext() { - return modelContextEDataType; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataFactory getMetadataFactory() { - return (MetadataFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - modelEClass = createEClass(MODEL); - createEReference(modelEClass, MODEL__ENTITY_GROUPS); - createEAttribute(modelEClass, MODEL__SOURCE_MODEL_PROVIDER); - createEAttribute(modelEClass, MODEL__CURRENT_MODEL_CONTEXT); - - entityGroupEClass = createEClass(ENTITY_GROUP); - - entityEClass = createEClass(ENTITY); - createEReference(entityEClass, ENTITY__CHILD_ENTITIES); - createEReference(entityEClass, ENTITY__TRAITS); - createEAttribute(entityEClass, ENTITY__ID); - createEAttribute(entityEClass, ENTITY__TYPE); - createEReference(entityEClass, ENTITY__INCLUDE_GROUPS); - - traitEClass = createEClass(TRAIT); - createEAttribute(traitEClass, TRAIT__ID); - createEReference(traitEClass, TRAIT__VALUE); - createEAttribute(traitEClass, TRAIT__SOURCE_MODEL_PROVIDER); - - includeEntityGroupEClass = createEClass(INCLUDE_ENTITY_GROUP); - createEAttribute(includeEntityGroupEClass, INCLUDE_ENTITY_GROUP__ID); - createEAttribute(includeEntityGroupEClass, INCLUDE_ENTITY_GROUP__MODEL_URI); - - // Create data types - iTraitVisitorEDataType = createEDataType(ITRAIT_VISITOR); - iEntityVisitorEDataType = createEDataType(IENTITY_VISITOR); - iMetaDataSourceModelProviderEDataType = createEDataType(IMETA_DATA_SOURCE_MODEL_PROVIDER); - modelContextEDataType = createEDataType(MODEL_CONTEXT); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Add supertypes to classes - modelEClass.getESuperTypes().add(this.getEntity()); - entityGroupEClass.getESuperTypes().add(this.getEntity()); - - // Initialize classes and features; add operations and parameters - initEClass(modelEClass, Model.class, "Model", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getModel_EntityGroups(), this.getEntityGroup(), null, "entityGroups", null, 0, -1, Model.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getModel_SourceModelProvider(), this.getIMetaDataSourceModelProvider(), "sourceModelProvider", null, 0, 1, Model.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getModel_CurrentModelContext(), this.getModelContext(), "currentModelContext", null, 0, 1, Model.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - EOperation op = addEOperation(modelEClass, this.getEntityGroup(), "findIncludeGroup", 0, 1); //$NON-NLS-1$ - addEParameter(op, ecorePackage.getEString(), "groupId", 0, 1); //$NON-NLS-1$ - - op = addEOperation(modelEClass, null, "accept"); //$NON-NLS-1$ - addEParameter(op, this.getIEntityVisitor(), "visitor", 0, 1); //$NON-NLS-1$ - - initEClass(entityGroupEClass, EntityGroup.class, "EntityGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(entityEClass, Entity.class, "Entity", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getEntity_ChildEntities(), this.getEntity(), null, "childEntities", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - getEntity_ChildEntities().getEKeys().add(this.getEntity_Id()); - getEntity_ChildEntities().getEKeys().add(this.getEntity_Type()); - initEReference(getEntity_Traits(), this.getTrait(), null, "traits", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - getEntity_Traits().getEKeys().add(this.getTrait_Id()); - initEAttribute(getEntity_Id(), ecorePackage.getEString(), "id", null, 1, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getEntity_Type(), ecorePackage.getEString(), "type", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getEntity_IncludeGroups(), this.getIncludeEntityGroup(), null, "includeGroups", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - op = addEOperation(entityEClass, null, "accept"); //$NON-NLS-1$ - addEParameter(op, this.getIEntityVisitor(), "visitor", 0, 1); //$NON-NLS-1$ - - op = addEOperation(entityEClass, this.getModel(), "getModel", 0, 1); //$NON-NLS-1$ - - initEClass(traitEClass, Trait.class, "Trait", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getTrait_Id(), ecorePackage.getEString(), "id", null, 1, 1, Trait.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEReference(getTrait_Value(), ecorePackage.getEObject(), null, "value", null, 1, 1, Trait.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getTrait_SourceModelProvider(), this.getIMetaDataSourceModelProvider(), "sourceModelProvider", null, 0, 1, Trait.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - op = addEOperation(traitEClass, null, "accept"); //$NON-NLS-1$ - addEParameter(op, this.getITraitVisitor(), "visitor", 0, 1); //$NON-NLS-1$ - - initEClass(includeEntityGroupEClass, IncludeEntityGroup.class, "IncludeEntityGroup", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getIncludeEntityGroup_Id(), ecorePackage.getEString(), "id", null, 1, 1, IncludeEntityGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getIncludeEntityGroup_ModelUri(), ecorePackage.getEString(), "modelUri", null, 0, 1, IncludeEntityGroup.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Initialize data types - initEDataType(iTraitVisitorEDataType, ITraitVisitor.class, "ITraitVisitor", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(iEntityVisitorEDataType, IEntityVisitor.class, "IEntityVisitor", !IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(iMetaDataSourceModelProviderEDataType, IMetaDataSourceModelProvider.class, "IMetaDataSourceModelProvider", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEDataType(modelContextEDataType, ModelKeyDescriptor.class, "ModelContext", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - // http://www.eclipse.org/emf/2002/GenModel - createGenModelAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ - addAnnotation - (modelEClass, - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "metadatamodel" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getModel_EntityGroups(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "entityGroup" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (entityEClass, - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "entity" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getEntity_ChildEntities(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "entity" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getEntity_Traits(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "trait" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getEntity_IncludeGroups(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "include-entity-group" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getIncludeEntityGroup_ModelUri(), - source, - new String[] { - "name", "uri" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (traitEClass, - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "trait" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getTrait_Value(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "namespace", "##targetNamespace" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - - /** - * Initializes the annotations for <b>http://www.eclipse.org/emf/2002/GenModel</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - @SuppressWarnings("cast") - protected void createGenModelAnnotations() { - String source = "http://www.eclipse.org/emf/2002/GenModel"; //$NON-NLS-1$ - addAnnotation - ((EOperation)traitEClass.getEOperations().get(0), - source, - new String[] { - "body", "visitor.visit(this);" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - -} //MetadataPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/ModelImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/ModelImpl.java deleted file mode 100644 index cfbb83e4d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/ModelImpl.java +++ /dev/null @@ -1,258 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ModelImpl.java,v 1.8 2010/01/27 23:54:32 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.util.EObjectResolvingEList; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.internal.ModelKeyDescriptor; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Model</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl#getEntityGroups <em>Entity Groups</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl#getSourceModelProvider <em>Source Model Provider</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.internal.impl.ModelImpl#getCurrentModelContext <em>Current Model Context</em>}</li> - * </ul> - * </p> - * - * @generated - */ -@SuppressWarnings("hiding") -public class ModelImpl extends EntityImpl implements Model { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getEntityGroups() <em>Entity Groups</em>}' reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEntityGroups() - * @generated - * @ordered - */ - protected EList entityGroups = null; - - /** - * The default value of the '{@link #getSourceModelProvider() <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceModelProvider() - * @generated - * @ordered - */ - protected static final IMetaDataSourceModelProvider SOURCE_MODEL_PROVIDER_EDEFAULT = null; - - /** - * The default value of the '{@link #getCurrentModelContext() <em>Current Model Context</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getCurrentModelContext() - * @generated - * @ordered - */ - protected static final ModelKeyDescriptor CURRENT_MODEL_CONTEXT_EDEFAULT = null; - - private IMetaDataSourceModelProvider sourceModelProvider; - - private ModelKeyDescriptor _modelContext; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ModelImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return MetadataPackage.Literals.MODEL; - } - - /** - * <!-- begin-user-doc --> - * May return null. - * <!-- end-user-doc --> - * @generated NOT - */ - public IMetaDataSourceModelProvider getSourceModelProvider() { - return sourceModelProvider; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void setSourceModelProvider(IMetaDataSourceModelProvider newSourceModelProvider) { - sourceModelProvider = newSourceModelProvider; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public ModelKeyDescriptor getCurrentModelContext() { - return _modelContext; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void setCurrentModelContext(ModelKeyDescriptor newCurrentModelContext) { - _modelContext = newCurrentModelContext; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getEntityGroups() { - if (entityGroups == null) { - entityGroups = new EObjectResolvingEList(EntityGroup.class, this, MetadataPackage.MODEL__ENTITY_GROUPS); - } - return entityGroups; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - return getEntityGroups(); - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - return getSourceModelProvider(); - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - return getCurrentModelContext(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - getEntityGroups().clear(); - getEntityGroups().addAll((Collection)newValue); - return; - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - setSourceModelProvider((IMetaDataSourceModelProvider)newValue); - return; - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - setCurrentModelContext((ModelKeyDescriptor)newValue); - return; - } - super.eSet(featureID, newValue); - } - - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public EntityGroup findIncludeGroup(String groupId){ - EntityGroup ret = null; - for (Iterator it=getEntityGroups().iterator();it.hasNext();){ - EntityGroup entityGroup = (EntityGroup)it.next(); - if (entityGroup.getId().equals(groupId)){ - ret = entityGroup; - break; - } - } - return ret; - } - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - getEntityGroups().clear(); - return; - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - setSourceModelProvider(SOURCE_MODEL_PROVIDER_EDEFAULT); - return; - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - setCurrentModelContext(CURRENT_MODEL_CONTEXT_EDEFAULT); - return; - } - super.eUnset(featureID); - } - /** - * <!-- begin-user-doc --> - * Due to a mistake in the EMF model, Model is not inheriting accept method from Entity. This should be fixed. - * <!-- end-user-doc --> - * @generated NOT - */ - - public void accept(IEntityVisitor visitor) { - super.accept(visitor); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public Model getModel() { - return this; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.MODEL__ENTITY_GROUPS: - return entityGroups != null && !entityGroups.isEmpty(); - case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER: - return SOURCE_MODEL_PROVIDER_EDEFAULT == null ? getSourceModelProvider() != null : !SOURCE_MODEL_PROVIDER_EDEFAULT.equals(getSourceModelProvider()); - case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT: - return CURRENT_MODEL_CONTEXT_EDEFAULT == null ? getCurrentModelContext() != null : !CURRENT_MODEL_CONTEXT_EDEFAULT.equals(getCurrentModelContext()); - } - return super.eIsSet(featureID); - } - -} //ModelImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/TraitImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/TraitImpl.java deleted file mode 100644 index 942168c85..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/impl/TraitImpl.java +++ /dev/null @@ -1,330 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitImpl.java,v 1.9 2008/11/18 22:24:39 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor; - - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Trait</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link TraitImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class TraitImpl extends EObjectImpl implements Trait { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected static final String ID_EDEFAULT = null; - - /** - * The cached value of the '{@link #getId() <em>Id</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getId() - * @generated - * @ordered - */ - protected String id = ID_EDEFAULT; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected EObject value = null; - - /** - * The default value of the '{@link #getSourceModelProvider() <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceModelProvider() - * @generated - * @ordered - */ - protected static final IMetaDataSourceModelProvider SOURCE_MODEL_PROVIDER_EDEFAULT = null; - - /** - * The cached value of the '{@link #getSourceModelProvider() <em>Source Model Provider</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getSourceModelProvider() - * @generated - * @ordered - */ - protected IMetaDataSourceModelProvider sourceModelProvider = SOURCE_MODEL_PROVIDER_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TraitImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return MetadataPackage.Literals.TRAIT; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param newValue - * @param msgs - * @return NotificationChain - * @generated - */ - public NotificationChain basicSetValue(EObject newValue, NotificationChain msgs) { - EObject oldValue = value; - value = newValue; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MetadataPackage.TRAIT__VALUE, oldValue, newValue); - if (msgs == null) msgs = notification; else msgs.add(notification); - } - return msgs; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(EObject newValue) { - if (newValue != value) { - NotificationChain msgs = null; - if (value != null) - msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MetadataPackage.TRAIT__VALUE, null, msgs); - if (newValue != null) - msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MetadataPackage.TRAIT__VALUE, null, msgs); - msgs = basicSetValue(newValue, msgs); - if (msgs != null) msgs.dispatch(); - } - else if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.TRAIT__VALUE, newValue, newValue)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public IMetaDataSourceModelProvider getSourceModelProvider() { - return sourceModelProvider; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setSourceModelProvider(IMetaDataSourceModelProvider newSourceModelProvider) { - IMetaDataSourceModelProvider oldSourceModelProvider = sourceModelProvider; - sourceModelProvider = newSourceModelProvider; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER, oldSourceModelProvider, sourceModelProvider)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getId() { - return id; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setId(String newId) { - String oldId = id; - id = newId; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, MetadataPackage.TRAIT__ID, oldId, id)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public void accept(ITraitVisitor visitor) { - visitor.visit(this); - visitor.visitCompleted(this); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case MetadataPackage.TRAIT__VALUE: - return basicSetValue(null, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case MetadataPackage.TRAIT__ID: - return getId(); - case MetadataPackage.TRAIT__VALUE: - return getValue(); - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - return getSourceModelProvider(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case MetadataPackage.TRAIT__ID: - setId((String)newValue); - return; - case MetadataPackage.TRAIT__VALUE: - setValue((EObject)newValue); - return; - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - setSourceModelProvider((IMetaDataSourceModelProvider)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case MetadataPackage.TRAIT__ID: - setId(ID_EDEFAULT); - return; - case MetadataPackage.TRAIT__VALUE: - setValue((EObject)null); - return; - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - setSourceModelProvider(SOURCE_MODEL_PROVIDER_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case MetadataPackage.TRAIT__ID: - return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); - case MetadataPackage.TRAIT__VALUE: - return value != null; - case MetadataPackage.TRAIT__SOURCE_MODEL_PROVIDER: - return SOURCE_MODEL_PROVIDER_EDEFAULT == null ? sourceModelProvider != null : !SOURCE_MODEL_PROVIDER_EDEFAULT.equals(sourceModelProvider); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (id: "); //$NON-NLS-1$ - result.append(id); - result.append(", sourceModelProvider: "); //$NON-NLS-1$ - result.append(sourceModelProvider); - result.append(')'); - return result.toString(); - } - - public boolean equals(Object value_){ - if (!(value_ instanceof String)) - return super.equals(value_); - - String key = (String)value_; - if (key.equals(getId())) - return true; - - return false; - } - - @Override - public int hashCode() - { - // try to match convention x.equals(y) => x.hashCode() == y.hashCode() - return getId() != null ? getId().hashCode() : 0xDEADBEEF; - } -} //TraitImpl
\ No newline at end of file diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/messages.properties deleted file mode 100644 index 5e9fd47a8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/messages.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 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 -############################################################################### - -MissingResource_exception=MissingResourceException for NLSPropertyValue: {0} -Key_not_found=(key not found) diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataAdapterFactory.java deleted file mode 100644 index f73a841d7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataAdapterFactory.java +++ /dev/null @@ -1,200 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataAdapterFactory.java,v 1.5 2008/11/18 22:24:36 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.util; - - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; - - - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage - * @generated - */ -public class MetadataAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static MetadataPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataAdapterFactory() { - if (modelPackage == null) { - modelPackage = MetadataPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch the delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected MetadataSwitch modelSwitch = - new MetadataSwitch() { - public Object caseModel(Model object) { - return createModelAdapter(); - } - public Object caseEntityGroup(EntityGroup object) { - return createEntityGroupAdapter(); - } - public Object caseEntity(Entity object) { - return createEntityAdapter(); - } - public Object caseTrait(Trait object) { - return createTraitAdapter(); - } - public Object caseIncludeEntityGroup(IncludeEntityGroup object) { - return createIncludeEntityGroupAdapter(); - } - public Object defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - public Adapter createAdapter(Notifier target) { - return (Adapter)modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.Trait <em>Trait</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.Trait - * @generated - */ - public Adapter createTraitAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup <em>Include Entity Group</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup - * @generated - */ - public Adapter createIncludeEntityGroupAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.Model <em>Model</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.Model - * @generated - */ - public Adapter createModelAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.Entity <em>Entity</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.Entity - * @generated - */ - public Adapter createEntityAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.EntityGroup <em>Entity Group</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.EntityGroup - * @generated - */ - public Adapter createEntityGroupAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //MetadataAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceFactoryImpl.java deleted file mode 100644 index 708b72f1e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceFactoryImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataResourceFactoryImpl.java,v 1.3 2008/11/18 22:24:36 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.util; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; - -/** - * <!-- begin-user-doc --> - * The <b>Resource Factory</b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.util.MetadataResourceImpl - * @generated - */ -public class MetadataResourceFactoryImpl extends ResourceFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public Resource createResource(URI uri) { - XMLResource result = new MetadataResourceImpl(uri); - result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - - result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); - return result; - } - -} //MetadataResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceImpl.java deleted file mode 100644 index 2db23d2b8..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataResourceImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataResourceImpl.java,v 1.12 2008/11/18 22:24:36 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.util; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.PackageNotFoundException; -import org.eclipse.emf.ecore.xmi.XMLHelper; -import org.eclipse.emf.ecore.xmi.XMLLoad; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler; -import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl; -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataSourceModelProvider; -import org.xml.sax.helpers.DefaultHandler; - -/** - * <!-- begin-user-doc --> - * The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.internal.util.MetadataResourceFactoryImpl - * @generated NOT - */ -public class MetadataResourceImpl extends XMLResourceImpl implements XMLResource.ResourceHandler { - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Oracle inc."; //$NON-NLS-1$ - - /** - * IMetaDataSourceModelProvider - */ - protected IMetaDataSourceModelProvider _provider; - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public MetadataResourceImpl(URI uri) { - super(uri); - } - - /** - * Constructor - */ - public MetadataResourceImpl() { - super(); - } - - - /** - * Constructor - * @param provider - */ - public MetadataResourceImpl(IMetaDataSourceModelProvider provider){ - super(); - _provider = provider; - } - - /** - * @generated NOT - */ - protected XMLLoad createXMLLoad() { - return new MetadataXMLLoad(createXMLHelper()); - } - /** - * Override createXMLHelper so that MetadataPackage.eINSTANCE is used for the NoNamespace package - * @generated NOT - */ - protected XMLHelper createXMLHelper() { - return new XMLHelperImpl(){ - @Override - public EPackage getNoNamespacePackage() { - return MetadataPackage.eINSTANCE; - } - }; - } - - public void postLoad(XMLResource resource, InputStream inputStream, - Map options) - { - final List<EObject> resContents = resource.getContents(); - - if (resContents.size() > 0) - { - final Object aRoot = resContents.get(0); - if (aRoot instanceof Model) - { - setModelKeyInTraits((Model) aRoot, (Model) aRoot); - } - } - else - { - JSFCommonPlugin.log(IStatus.WARNING, - "No model loaded for "+getURI()); //$NON-NLS-1$ - } - } - - private void setModelKeyInTraits(Model root, Entity currentEntity) { - // TODO: does this have side effect that we care about? nothing is done with the return value - MetadataPackage.eINSTANCE.getTrait_SourceModelProvider(); - for (int i=0;i < currentEntity.getTraits().size();i++){ - ((Trait)currentEntity.getTraits().get(i)).setSourceModelProvider(_provider); - } - for (int j=0;j < currentEntity.getChildEntities().size();j++){ - setModelKeyInTraits(root,(Entity)currentEntity.getChildEntities().get(j)); - } - - if (currentEntity == root){ - for (int k=0;k < root.getEntityGroups().size();k++){ - setModelKeyInTraits(root,(Entity)root.getEntityGroups().get(k)); - } - } - } - - - public void postSave(XMLResource resource, OutputStream outputStream, - Map options) { - // do nothing - } - - public void preLoad(XMLResource resource, InputStream inputStream, - Map options) { - // do nothing - } - - public void preSave(XMLResource resource, OutputStream outputStream, - Map options) { - // do nothing - } - - /** - * Override the handleErrors() method so that resource will load gracefully, and errors reported later - * when appropriate - * - * @generated NOT - */ - private static class MetadataXMLLoad extends XMLLoadImpl { - - public MetadataXMLLoad(XMLHelper helper) { - super(helper); - } - - @Override - protected void handleErrors() throws IOException { - //by doing nothing here, this allows the list of non-fatal errors (res.getErrors()) to be returned - } - - @Override - protected DefaultHandler makeDefaultHandler() { - return new MetadataXMLHandler(resource, helper, options); - } - } - - /** - * Ensures that only EMF extension models registered with the EMF Package Registry are considered. - * @generated NOT - */ - private static class MetadataXMLHandler extends SAXXMLHandler { - - public MetadataXMLHandler(XMLResource xmiResource, XMLHelper helper, - Map<?, ?> options) { - super(xmiResource, helper, options); - } - - @Override - protected EPackage getPackageForURI(String uriString) { - //code taken from super and modified so that only package registry is considered - if (uriString == null) - { - return null; - } - - EPackage ePackage = packageRegistry.getEPackage(uriString); - - if (ePackage != null && ePackage.eIsProxy()) - { - ePackage = null; - } - - if (ePackage == null) - { - ePackage = handleMissingPackage(uriString); - } - - if (ePackage == null) - { - error - (new PackageNotFoundException - (uriString, - getLocation(), - getLineNumber(), - getColumnNumber())); - } - - return ePackage; - } - } -} //MetadataResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataSwitch.java deleted file mode 100644 index 141be3bab..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataSwitch.java +++ /dev/null @@ -1,233 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataSwitch.java,v 1.7 2008/11/18 22:24:36 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.util; - - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.EntityGroup; -import org.eclipse.jst.jsf.common.metadata.IncludeEntityGroup; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; - - - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.MetadataPackage - * @generated - */ -public class MetadataSwitch { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static MetadataPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataSwitch() { - if (modelPackage == null) { - modelPackage = MetadataPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param theEObject - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public Object doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param theEClass - * @param theEObject - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch((EClass)eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param classifierID - * @param theEObject - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case MetadataPackage.MODEL: { - Model model = (Model)theEObject; - Object result = caseModel(model); - if (result == null) result = caseEntity(model); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.ENTITY_GROUP: { - EntityGroup entityGroup = (EntityGroup)theEObject; - Object result = caseEntityGroup(entityGroup); - if (result == null) result = caseEntity(entityGroup); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.ENTITY: { - Entity entity = (Entity)theEObject; - Object result = caseEntity(entity); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.TRAIT: { - Trait trait = (Trait)theEObject; - Object result = caseTrait(trait); - if (result == null) result = defaultCase(theEObject); - return result; - } - case MetadataPackage.INCLUDE_ENTITY_GROUP: { - IncludeEntityGroup includeEntityGroup = (IncludeEntityGroup)theEObject; - Object result = caseIncludeEntityGroup(includeEntityGroup); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Trait</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Trait</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseTrait(Trait object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Include Entity Group</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Include Entity Group</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseIncludeEntityGroup(IncludeEntityGroup object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Model</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Model</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseModel(Model object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Entity</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Entity</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEntity(Entity object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>Entity Group</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>Entity Group</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseEntityGroup(EntityGroup object) { - return null; - } - - /** - * Returns the result of interpretting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpretting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} //MetadataSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataXMLProcessor.java deleted file mode 100644 index 036ef6b48..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/util/MetadataXMLProcessor.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: MetadataXMLProcessor.java,v 1.4 2008/11/18 22:24:36 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.internal.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; -import org.eclipse.jst.jsf.common.metadata.MetadataPackage; - - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class MetadataXMLProcessor extends XMLProcessor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public MetadataXMLProcessor() { - super((EPackage.Registry.INSTANCE)); - MetadataPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the MetadataResourceFactoryImpl factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map getRegistrations() { - if (registrations == null) { - super.getRegistrations(); - registrations.put(XML_EXTENSION, new MetadataResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new MetadataResourceFactoryImpl()); - } - return registrations; - } - -} //MetadataXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/package-info.java deleted file mode 100644 index 836883f01..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * EMF interface objects for design-time metadata. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.metadata; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java deleted file mode 100644 index 059169690..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityQueryVisitor.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract class implementing {@link IEntityQueryVisitor} that concrete subclasses should provide implementations - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractEntityQueryVisitor extends AbstractEntityVisitor - implements IEntityQueryVisitor { - - /** - * @return EmptyResultSet. Subclasses should override. - */ - public IResultSet findEntities(Entity initialEntityContext, String entityKey) { - return new EmptyResultSet(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java deleted file mode 100644 index 54e6f0165..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractEntityVisitor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract implementation that concrete subclasses should ovveride - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractEntityVisitor extends AbstractMetaDataVisitor - implements IEntityVisitor { - - public abstract void visit(Entity entity); - - public void visitCompleted(Entity entity){ - //subclasses should override if needed - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java deleted file mode 100644 index 15443e5d5..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractMetaDataVisitor.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -/** - * Abstract class implementing {@link IMetaDataVisitor} - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractMetaDataVisitor implements IMetaDataVisitor { - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return false; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java deleted file mode 100644 index df733d541..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.Collections; -import java.util.List; - -/** - * Abstract implementation of {@link IResultSet} that developers may subclass. - * Users should assume that the results are only valid at the time of the query. This may change in the future. - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractResultSet/*<T>*/ implements IResultSet/*<T>*/ { - private List _results; - private boolean _isClosed = false; - - public List getResults() throws MetaDataException { - initIfNecessary(); - return _results; - } - - public final void close() throws MetaDataException { - doClose(); - _isClosed = true; - _results = null; - } - - /** - * Overridable method to close resultset. This is called by close() - * @throws MetaDataException - */ - protected void doClose() throws MetaDataException { - //subclasses to provide override - } - - public final boolean isClosed() { - return _isClosed; - } - - /** - * @return List of results. Null is tolerated. - */ - protected abstract List getInternalResults(); - - private void initIfNecessary() throws MetaDataException { - if (_isClosed) - throw new MetaDataException("Attempt to access a closed resultset."); //$NON-NLS-1$ - - if (_results == null) { - List checkNullResults = getInternalResults(); - if (checkNullResults == null){ - checkNullResults = Collections.EMPTY_LIST; - } - _results = Collections.unmodifiableList(checkNullResults); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java deleted file mode 100644 index ddb894088..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitQueryVisitor.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Abstract implmentation of {@link ITraitQueryVisitor} that subclasses should use to provide implmentation - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractTraitQueryVisitor extends AbstractTraitVisitor implements - ITraitQueryVisitor { - - /** - * @return EmptyResultSet. Subclasses should override. - */ - public IResultSet findTraits(Entity entity, String traitKey) { - return new EmptyResultSet(); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java deleted file mode 100644 index 795a473e1..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractTraitVisitor.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Abstract Trait visitor - * <p><b>Provisional API - subject to change</b></p> - */ -public abstract class AbstractTraitVisitor extends AbstractMetaDataVisitor implements ITraitVisitor{ - - public abstract void visit(final Trait trait); - - public void visitCompleted(final Trait trait) { - //subclasses should override if needed - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java deleted file mode 100644 index 26a1c7653..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/EmptyResultSet.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.Collections; -import java.util.List; - -/** - * Implementation of an empty result set - * <p><b>Provisional API - subject to change</b></p> - */ -public final class EmptyResultSet implements IResultSet { - private boolean _isClosed = false; - public void close() { - _isClosed = true; - } - - public List getResults() throws MetaDataException{ - if (_isClosed) - throw new MetaDataException("Resultset is closed"); //$NON-NLS-1$ - - return Collections.EMPTY_LIST; - } - - public boolean isClosed() { - return _isClosed; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java deleted file mode 100644 index 7f168c162..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityQueryVisitor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Entity querying interface - * <p>NOT to implemented by clients directly. Clients should subclass AbstractEntityQueryVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IEntityQueryVisitor extends IEntityVisitor{ - /** - * @param initialEntityContext - * @param entityKey to find relative to the passed intialEntityContext - * @return IResultSet of Entities matching the key. IResultSet must NOT be null. Implementers may return {@link EmptyResultSet}. - */ - public IResultSet/*<Entity>*/ findEntities(final Entity initialEntityContext, - final String entityKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java deleted file mode 100644 index fcc178381..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IEntityVisitor.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Visitor interface for Entities - * <p>NOT to implemented by clients directly. Clients should subclass AbstractEntityVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IEntityVisitor extends IMetaDataVisitor { - /** - * Visit the entity. - * The entity and then it's children are visited - * @param entity - must not be NULL - */ - public void visit(final Entity entity); - /** - * Signal that the entity and all it's children is now completely 'visited'. - * The entity will call this method at the end of the accept method. - * @param entity - must not be NULL - */ - public void visitCompleted(Entity entity); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java deleted file mode 100644 index c70cdd981..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataModelContext.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.context.IModelContext; - -/** - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IMetaDataModelContext extends IModelContext { - /** - * @return domain identifier for this context. - * <p>This must match the domain id from the org.eclipse.jst.jsf.common.DomainLoadingStrategies - */ - public String getDomainID(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java deleted file mode 100644 index 35a3652a3..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IMetaDataVisitor.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -/** - * Common interface for Entity and Trait visitors - * <p>NOT to implemented by clients directly. Clients should subclass AbstractMetaDataVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IMetaDataVisitor { - /** - * @return true if visitor has recognized that visiting should stop - */ - public boolean stopVisiting(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java deleted file mode 100644 index 0d0ab4866..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/IResultSet.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.List; - - - -/** - * Results from a metadata query. The resultset should be considered valid only at the time that the query is performed. - * Once "closed", the resultset should not be accessed again. - * - * <p>Not intended to be implemented directly by clients. Developers should extend {@link AbstractResultSet} instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface IResultSet/*<T>*/{ - - /** - * @return unmodifiable List of results. May NOT be null. Implementer must return Collections.EMPTY_LIST instead. - * @throws MetaDataException - */ - public List/*<T>*/ getResults() throws MetaDataException; - - /** - * Signal that the query results are no longer required allowing for any cleanup that may be required - * Once a resultset is closed, a MetaDataException should be thrown if the next() or hasNext() is called. Clients can check isClosed() first. - * @throws MetaDataException - */ - public void close() throws MetaDataException; - - /** - * @return true if this resultset has been closed. - */ - public boolean isClosed(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java deleted file mode 100644 index 17595f9ea..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITaglibDomainMetaDataModelContext.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.core.resources.IProject; - -/** - * Context for determining the Model to locate in the MetaDataManager - * <p>Should NOT be implemented by clients - * <p><b>Provisional API - subject to change</b></p> - */ -public interface ITaglibDomainMetaDataModelContext extends IMetaDataModelContext { - /** - * @return project - */ - public IProject getProject(); - /** - * @return the namespace URI as String - */ - public String getURI(); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java deleted file mode 100644 index fd96a3721..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitQueryVisitor.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Entity; - -/** - * Trait querying interface - * <p>NOT to implemented by clients directly. Clients should subclass AbstractTraitQueryVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface ITraitQueryVisitor extends ITraitVisitor{ - /** - * @param entity - * @param traitKey - * @return IResultSet of Traits. IResultSet must NOT be null. Implementers may return {@link EmptyResultSet}. - */ - public IResultSet/*<Trait>*/ findTraits(final Entity entity, - final String traitKey); - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java deleted file mode 100644 index 9b39a101d..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/ITraitVisitor.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import org.eclipse.jst.jsf.common.metadata.Trait; - -/** - * Visitor interface for Traits - * <p>NOT to implemented by clients directly. Clients should subclass AbstractTraitVisitor instead. - * <p><b>Provisional API - subject to change</b></p> - */ -public interface ITraitVisitor extends IMetaDataVisitor { - /** - * Visit the Trait. - * Implementer cannot assume ordering of trait visiting. - * @param trait - must not be null - */ - public void visit(final Trait trait); - - /** - * Signal that the the trait has been completely visited - * @param trait - */ - public void visitCompleted(final Trait trait); -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java deleted file mode 100644 index 50b314fbe..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/MetaDataException.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -/** - * Exception intended to be superclass of all exceptions thrown while handling metadata during query - * <p><b>Provisional API - subject to change</b></p> - */ -public class MetaDataException extends Exception { - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * Constructor - */ - public MetaDataException(){ - super(); - } - /** - * Constructor - * @param msg - */ - public MetaDataException(String msg){ - super(msg); - } - - /** - * Constructor - * @param msg - * @param cause - */ - public MetaDataException(String msg, Throwable cause){ - super(msg, cause); - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java deleted file mode 100644 index 52dd507c9..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/TaglibDomainMetaDataQueryHelper.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query; - -import javax.xml.namespace.QName; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jst.jsf.common.JSFCommonPlugin; -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Model; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModel; -import org.eclipse.jst.jsf.common.metadata.internal.TaglibDomainMetaDataModelContextImpl; -import org.eclipse.jst.jsf.common.metadata.internal.MetaDataModelManager; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleEntityQueryVisitorImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.SimpleTraitQueryVisitorImpl; -import org.eclipse.jst.jsf.common.metadata.query.internal.HierarchicalSearchControl; - - -/** - * Helper class with static methods to simplify querying of a metadata model. - * - * <p>Steps for use: - * <br>1) Get the ITaglibDomainMetaDataModelContext using createMetaDataModelContext or createTagLibraryDomainMetaDataModelContext - * <br>2) Use appropriate getXXX methods using the ITaglibDomainMetaDataModelContext. - * <p><b>Provisional API - subject to change</b></p> - * @see IResultSet - * @see IEntityQueryVisitor - * @see ITraitQueryVisitor - * @see ITaglibDomainMetaDataModelContext - * @see Model - * @see Entity - * @see Trait - */ -public final class TaglibDomainMetaDataQueryHelper{ - /** - * Domain id for Tag library domain of metatdata - */ - public static final String TAGLIB_DOMAIN = "TagLibraryDomain"; //need better place for this //$NON-NLS-1$ - - /** - * private constructor - */ - private TaglibDomainMetaDataQueryHelper (){ - super(); - } - - /** - * Convenience method for creating {@link ITaglibDomainMetaDataModelContext}s for TAGLIB_DOMAIN - * @param project - * @param uri - * @return ITaglibDomainMetaDataModelContext - */ - public static ITaglibDomainMetaDataModelContext createMetaDataModelContext(IProject project, String uri){ - return new TaglibDomainMetaDataModelContextImpl(TAGLIB_DOMAIN, project, uri); - } - /** - * @param modelContext - * @return Model object for given context. May return null if not located. - */ - public static Model getModel(final ITaglibDomainMetaDataModelContext modelContext) { - MetaDataModel model = getMDModel(modelContext); - //we may want to throw error that model is empty - if (model != null && !model.isEmpty()){ - return (Model)model.getRoot(); - } - return null; - } - - /** - * @param modelContext - * @param entityKey relative to root of the model - * @return the first entity match from the root of the model. May return null. - */ - public static Entity getEntity(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey) { - IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - IResultSet/*<Entity>*/ rs = getEntities(modelContext,entityKey, visitor); - Entity e = null; - try { - if (! rs.getResults().isEmpty()){ - e = (Entity)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getEntity() - 1", ex); //$NON-NLS-1$ - } - - return e; - } - - /** - * @param modelContext - * @param entityKey relative to root of model - * @param visitor - * @return an IResultSet of entity objects - */ - public static IResultSet/*<Entity>*/ getEntities(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey, final IEntityQueryVisitor visitor){ - Model model = getModel(modelContext); - //we may want to throw error that model is empty - return getEntities(model, entityKey, visitor); - - } - - /** - * @param entity - * @param traitKey - * @return a trait or null for the given entity and traitKey using a SimpleEntityQueryVisitorImpl - */ - public static Trait getTrait(final Entity entity, final String traitKey){ - ITraitQueryVisitor visitor = new SimpleTraitQueryVisitorImpl(); - Trait t= null; - IResultSet/*<Trait>*/ rs = getTraits(entity, traitKey, visitor); - try { - if (! rs.getResults().isEmpty()){ - t = (Trait)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getTrait()", ex); //$NON-NLS-1$ - } - - return t; - } - - /** - * @param entity - * @param traitKey - * @param traitQueryVisitor - * @return an IResultSet of trait objects using supplied traitQueryVisitor. IResultSet should NOT be null. - */ - public static IResultSet/*<Trait>*/ getTraits(Entity entity, String traitKey, - ITraitQueryVisitor traitQueryVisitor) { - IResultSet/*<Trait>*/ rs = traitQueryVisitor.findTraits(entity, traitKey); - return rs; - } - - /** - * @param initialEntityContext - * @param entityKey relative to initial passed entity - * @return the first entity located by key using SimpleEntityQueryVisitorImpl - */ - public static Entity getEntity(Entity initialEntityContext, String entityKey) { - IEntityQueryVisitor visitor = new SimpleEntityQueryVisitorImpl(new HierarchicalSearchControl(1, HierarchicalSearchControl.SCOPE_ALL_LEVELS)); - Entity e= null; - IResultSet/*<Entity>*/ rs = getEntities(initialEntityContext, entityKey, visitor); - try { - if (! rs.getResults().isEmpty()){ - e = (Entity)rs.getResults().get(0); - } - rs.close(); - } catch (MetaDataException ex) { - JSFCommonPlugin.log(IStatus.ERROR, "Error in Helper.getEntity() - 0", ex); //$NON-NLS-1$ - } - - return e; - } - - /** - * @param initialEntityContext - * @param entityQuery relative to initial passed entity - * @param entityKeyQueryVisitor - * @return IResultSet of entities located by key using entityQueryVisitor. IResultSet should NOT be null. - */ - public static IResultSet/*<Entity>*/ getEntities(Entity initialEntityContext, String entityQuery, - IEntityQueryVisitor entityKeyQueryVisitor) { - - return entityKeyQueryVisitor.findEntities(initialEntityContext, entityQuery); - } - - - /** - * Retrieve the MetaDataModel from the ModelManager for given key - * @param modelContext - * @return MetaDataModel - */ - private static MetaDataModel getMDModel(final ITaglibDomainMetaDataModelContext modelContext){ - MetaDataModelManager mgr = null; - if (modelContext.getProject() != null) - mgr = MetaDataModelManager.getInstance(modelContext.getProject()); - else //temp(?) - mgr = MetaDataModelManager.getSharedInstance(); - - if (mgr != null) - return mgr.getModel(modelContext); - - return null; - } - - /** - * @param modelContext - * @param entityKey - * @param traitKey - * @return first trait found for entity and trait key starting from root of the model using SimpleMetaDataQueryImpl - */ - public static Trait getTrait(final ITaglibDomainMetaDataModelContext modelContext, - final String entityKey, final String traitKey) { - Entity entity = getEntity(modelContext, entityKey); - Trait t = null; - if (entity != null){ - t = getTrait(entity, traitKey); - } - return t; - } - - /** - * @param tagEntity - * @return QName for tag entity - */ - public static QName getQNameForTagEntity(Entity tagEntity) { - Assert.isTrue(tagEntity != null); - return new QName(tagEntity.getModel().getCurrentModelContext().getUri(), tagEntity.getId()); - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java deleted file mode 100644 index 36d446e56..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/HierarchicalSearchControl.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Sets controls on how a tree of nodes can be searched - */ -public class HierarchicalSearchControl extends SearchControl { - //scope levels - /** - * Do not recurse. - */ - public static final int SCOPE_CURRENT_LEVEL = 0; - /** - * Allow for one level of children to be visited from initial context - */ - public static final int SCOPE_ONE_LEVEL = 1; - /** - * Allow unlimited recursion of children - */ - public static final int SCOPE_ALL_LEVELS = 2; - - private int scope = SCOPE_ALL_LEVELS; - - /** - * Constructor using defaults of COUNT_LIMIT_NONE and SCOPE_ALL_LEVELS - */ - public HierarchicalSearchControl(){ - super(); - } - /** - * Constructor - * @param countLimit - * @param scope - */ - public HierarchicalSearchControl(int countLimit, int scope){ - super(countLimit); - this.scope = scope; - } - - - /** - * @param scope - */ - public void setScope(int scope){ - this.scope= scope; - } - - /** - * @return scope - */ - public int getScope(){ - return scope; - } -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java deleted file mode 100644 index b91fd9e42..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/IHierarchicalEntityVisitor.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor; - -/** - * Provides the necessary hierarchical visitor interface methods to - * provide conditional navigation of the entity hierarchy - * - */ -public interface IHierarchicalEntityVisitor extends IEntityVisitor { - /** - * @param entity - * @return true if children should be traversed - */ - boolean visitEnter(Entity entity); - /** - * @param entity - * @return true when coming out of a branch - */ - boolean visitLeave(Entity entity); - - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java deleted file mode 100644 index 43e131752..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SearchControl.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -/** - * Simple class used by {@link SimpleEntityQueryVisitorImpl} allowing some control of a metadata query. - * A query visitor can use this to optimize the query results and signal completion. - */ -public class SearchControl { - - /** - * No limit on query results - */ - public static final int COUNT_LIMIT_NONE = -1; - - //default settings - private int countLimit = COUNT_LIMIT_NONE; - - - /** - * Constructor using defaults of COUNT_LIMIT_NONE - */ - public SearchControl(){ - //use default settings - } - - /** - * Constructor - * @param countLimit - */ - public SearchControl(int countLimit){ - this.countLimit = countLimit; - } - - /** - * @param limit results count limit - */ - public void setCountLimit(int limit){ - this.countLimit = limit; - } - - /** - * @return query results count limit - */ - public int getCountLimit(){ - return countLimit; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java deleted file mode 100644 index ea68a0140..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleEntityQueryVisitorImpl.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.query.AbstractEntityQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; - - -/** - * A simple metadata query visitor implementing {@link org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor} and {@link org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor}.<p> - * - simple find entity and traits by id only <br> - * - does not allow for wild card searchs<br> - * <p> - * TODO - fix for case-sensitivity https://bugs.eclipse.org/bugs/show_bug.cgi?id=212794 - * - */ -public class SimpleEntityQueryVisitorImpl extends AbstractEntityQueryVisitor implements IHierarchicalEntityVisitor { - private HierarchicalSearchControl control; - private boolean _stop; - - private EntityQueryFilterVisitor entityQuery; - private List/*<Entity>*/ _entityResults; - private Entity initialEntityContext; - - /** - * Constructor that also creates a default SearchControl - */ - public SimpleEntityQueryVisitorImpl() { - super(); - control = new HierarchicalSearchControl(); - } - - /** - * Constructor - * @param control - */ - public SimpleEntityQueryVisitorImpl(final HierarchicalSearchControl control) { - super(); - this.control = control; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityQueryVisitor#findEntities(org.eclipse.jst.jsf.common.metadata.Entity, java.lang.String) - */ - public IResultSet/*<Entity>*/ findEntities(final Entity initialEntity, - final String entityKey) { - - resetQuery(); - - if (initialEntity != null){ - this.initialEntityContext = initialEntity; - entityQuery = new EntityQueryFilterVisitor(initialEntity.getId(), entityKey); - initialEntity.accept(this); - } - - return new SimpleResultSet(getInternalEntityResults()); - } - - private void resetQuery() { - _stop = false; - _entityResults = null; - } - - private List/*<Entity>*/ getInternalEntityResults(){ - if (_entityResults == null){ - _entityResults = new ArrayList/*<Entity>*/(); - } - return _entityResults; - } - - - public boolean visitEnter(final Entity entity) { - - if (entity == initialEntityContext) - return true; - - entityQuery.pushLevel(); - if (entityQuery.canVisit(entity)) - return entityQuery.visit(entity); - - return false; - } - - public boolean visitLeave(Entity entity) { - checkShouldStopVisitingEntities(); - if (entity != initialEntityContext) - entityQuery.popLevel(); - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IEntityVisitor#visit(org.eclipse.jst.jsf.common.metadata.Entity) - */ - public void visit(final Entity key) { - //do nothing... all work now done in visitEnter/visitLeave - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingEntities(){ - //implement how to set stop to signal to the entity accept() to skip visiting - if (_stop == false - && control.getCountLimit()== getInternalEntityResults().size() - && control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE ) - - _stop = true; - } - - /** - * Visitor that filters and acts upon hierarchical data that compares that an entity's id for with another with case-insensitive compare - */ - private class EntityQueryFilterVisitor { - - private String entityId; - private List<String> entityQueue; - private int curLevel = 0; - - /** - * Constructor - * @param initialContextId - Entity id from which the query is rooted - * @param queryKey - query key which may be compound ("A/B/C") - */ - public EntityQueryFilterVisitor(final String initialContextId, final String queryKey){ - init(initialContextId, queryKey); - } - - private void init(final String initialContextId, final String key) { - entityQueue = new ArrayList<String>(3); - addLevel(initialContextId); - if (key == null || key.trim().equals("") || key.trim().equals("/")){ //$NON-NLS-1$ //$NON-NLS-2$ - addLevel(""); //$NON-NLS-1$ - } - else { - final StringTokenizer st = new StringTokenizer(key, "/"); //$NON-NLS-1$ - String partialKey = st.nextToken(); - addLevel(partialKey); - while (st.hasMoreElements()){ - partialKey = st.nextToken(); - addLevel(partialKey); - } - } - } - - /** - * @param entity - * @return flag indicating that filter was passed and children may be visited - */ - public boolean canVisit(final Entity entity) { - // only one filter rule... does this entity id match the current level's entity id (case-insensitive) - return entityId.compareTo(entity.getId().toUpperCase()) == 0; - } - - /** - * Operates on passed entity and determines if it should be part of the query results - * @param entity - * @return true if children of entity should be visited - */ - public boolean visit(final Entity entity) { - //one operation... if we have found the leaf-most entity in the query, add it to the results and go no deeper - if (curLevel == entityQueue.size() - 1) { - getInternalEntityResults().add(entity); - return false; - } - return true; - } - - private void addLevel(final String key) { - entityQueue.add(key.toUpperCase()); - } - - /** - * Move up one level in the query - */ - public void popLevel(){ - entityId = entityQueue.get(--curLevel); - } - - /** - * Move down one level in the query - */ - public void pushLevel() { - entityId = entityQueue.get(++curLevel); - } - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java deleted file mode 100644 index a3b2f2ae2..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleResultSet.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - - -import java.util.Collections; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.query.AbstractResultSet; - -/** - * Simple implementation of {@link org.eclipse.jst.jsf.common.metadata.query.IResultSet} by extending AbstractResultSet - * - */ -public final class SimpleResultSet/*<T>*/ extends AbstractResultSet/*<T>*/ { - private List/*<T>*/ results; - - /** - * Constructor passing a list to hold the results - * @param results - */ - public SimpleResultSet(List/*<T>*/ results){ - super(); - this.results = results; - } - - protected List getInternalResults(){ - if (results == null){ - results = Collections.EMPTY_LIST; - } - return results; - } - - -} - diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java deleted file mode 100644 index 00423648f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/internal/SimpleTraitQueryVisitorImpl.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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: - * Oracle - initial API and implementation - * - ********************************************************************************/ -package org.eclipse.jst.jsf.common.metadata.query.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jst.jsf.common.metadata.Entity; -import org.eclipse.jst.jsf.common.metadata.Trait; -import org.eclipse.jst.jsf.common.metadata.query.AbstractTraitQueryVisitor; -import org.eclipse.jst.jsf.common.metadata.query.IResultSet; - - -/** - * A simple metadata query visitor implementing {@link org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor}. - * - simple find traits by id only - * - Does not allow for wild card searchs - */ -public class SimpleTraitQueryVisitorImpl extends AbstractTraitQueryVisitor { - - private String _traitQuery; - private SearchControl _control; - private boolean _stop; - private List/*<Trait>*/ _traitResults; - - /** - * Constructor that also creates a default SearchControl - */ - public SimpleTraitQueryVisitorImpl() { - super(); - _control = new SearchControl(); - } - - /** - * Constructor - * @param control - */ - public SimpleTraitQueryVisitorImpl(SearchControl control) { - super(); - this._control = control; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitQueryVisitor#findTraits(org.eclipse.jst.jsf.common.metadata.Entity, java.lang.String) - */ - public IResultSet/*<Trait>*/ findTraits(final Entity entity, final String traitQuery){ - - resetQuery(); - if (entity != null){ - this._traitQuery = traitQuery; - for (Iterator/*<Trait>*/ it=entity.getTraits().iterator();it.hasNext();){ - Trait t = (Trait)it.next(); - t.accept(this); - if (stopVisiting()) - break; - } - } - return new SimpleResultSet(getInternalTraitResults()); - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.ITraitVisitor#visit(org.eclipse.jst.jsf.common.metadata.Trait) - */ - public void visit(Trait trait) { - if (trait.equals(_traitQuery)) - getInternalTraitResults().add(trait); - - checkShouldStopVisitingTraits(); - } - - /** - * - */ - private void resetQuery() { - _stop = false; - _traitResults = null; - } - - /** - * @return lazy init of a SimpleResultSet of Traits - */ - private List/*<Trait>*/ getInternalTraitResults(){ - if (_traitResults == null){ - _traitResults = new ArrayList/*<Trait>*/(); - } - return _traitResults; - } - - /* (non-Javadoc) - * @see org.eclipse.jst.jsf.common.metadata.query.IMetaDataVisitor#stopVisiting() - */ - public boolean stopVisiting() { - return _stop; - } - - private void checkShouldStopVisitingTraits(){ - if (_control.getCountLimit()== getInternalTraitResults().size() && _control.getCountLimit() != SearchControl.COUNT_LIMIT_NONE) - _stop = true; - } - -} diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java deleted file mode 100644 index bb9019ece..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Meta-data query interface. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.metadata.query; diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/BooleanValue.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/BooleanValue.java deleted file mode 100644 index 9a658b861..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/BooleanValue.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: BooleanValue.java,v 1.1 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Boolean Value</b></em>'. - * - * Only String value of 'true' in xml will result in isTrue() being true. - * All other String values will result in false. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue <em>True</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getBooleanValue() - * @model extendedMetaData="kind='simple'" - * @generated - */ -public interface BooleanValue extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>True</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>True</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>True</em>' attribute. - * @see #setTrue(boolean) - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getBooleanValue_True() - * @model required="true" - * extendedMetaData="kind='simple'" - * @generated - */ - boolean isTrue(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue <em>True</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>True</em>' attribute. - * @see #isTrue() - * @generated - */ - void setTrue(boolean value); - -} // BooleanValue diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/ListOfValues.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/ListOfValues.java deleted file mode 100644 index 12e92a411..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/ListOfValues.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>List Of Values</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues#getEntries <em>Entries</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getListOfValues() - * @model - * @generated - */ -public interface ListOfValues extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Entries</b></em>' containment reference list. - * The list contents are of type {@link org.eclipse.emf.ecore.xml.type.SimpleAnyType}. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Entries</em>' containment reference list isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Entries</em>' containment reference list. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getListOfValues_Entries() - * @model type="org.eclipse.emf.ecore.xml.type.SimpleAnyType" containment="true" - * extendedMetaData="kind='element' name='item'" - * @generated - */ - EList getEntries(); - -} // ListOfValues diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/SetGenerator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/SetGenerator.java deleted file mode 100644 index 023ae6f4a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/SetGenerator.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>Set Generator</b></em>'. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getSetGenerator() - * @model - * @generated - */ -public interface SetGenerator extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Algorithm</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Algorithm</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Algorithm</em>' attribute. - * @see #setAlgorithm(String) - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getSetGenerator_Algorithm() - * @model extendedMetaData="kind='element'" - * @generated - */ - String getAlgorithm(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getAlgorithm <em>Algorithm</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Algorithm</em>' attribute. - * @see #getAlgorithm() - * @generated - */ - void setAlgorithm(String value); - - /** - * Returns the value of the '<em><b>Expression</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Expression</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Expression</em>' attribute. - * @see #setExpression(String) - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getSetGenerator_Expression() - * @model extendedMetaData="kind='element'" - * @generated - */ - String getExpression(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getExpression <em>Expression</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Expression</em>' attribute. - * @see #getExpression() - * @generated - */ - void setExpression(String value); - -} // SetGenerator diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/StringValue.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/StringValue.java deleted file mode 100644 index b978ad871..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/StringValue.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: StringValue.java,v 1.1 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> - * A representation of the model object '<em><b>String Value</b></em>'. - * <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getStringValue() - * @model extendedMetaData="kind='simple'" - * @generated - */ -public interface StringValue extends EObject { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - String copyright = "Copyright (c) 2007 Oracle Corporation";//$NON-NLS-1$ - - /** - * Returns the value of the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' attribute isn't clear, - * there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * @return the value of the '<em>Value</em>' attribute. - * @see #setValue(String) - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#getStringValue_Value() - * @model required="true" - * extendedMetaData="kind='simple'" - * @generated - */ - String getValue(); - - /** - * Sets the value of the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue#getValue <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param value the new value of the '<em>Value</em>' attribute. - * @see #getValue() - * @generated - */ - void setValue(String value); - -} // StringValue diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesFactory.java deleted file mode 100644 index af30b04c7..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesFactory.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> - * The <b>Factory</b> for the model. - * It provides a create method for each non-abstract class of the model. - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage - * @generated - */ -public interface TraitTypesFactory extends EFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The singleton instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - TraitTypesFactory eINSTANCE = org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesFactoryImpl.init(); - - /** - * Returns a new object of class '<em>List Of Values</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>List Of Values</em>'. - * @generated - */ - ListOfValues createListOfValues(); - - /** - * Returns a new object of class '<em>Set Generator</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Set Generator</em>'. - * @generated - */ - SetGenerator createSetGenerator(); - - /** - * Returns a new object of class '<em>String Value</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>String Value</em>'. - * @generated - */ - StringValue createStringValue(); - - /** - * Returns a new object of class '<em>Boolean Value</em>'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return a new object of class '<em>Boolean Value</em>'. - * @generated - */ - BooleanValue createBooleanValue(); - - /** - * Returns the package supported by this factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the package supported by this factory. - * @generated - */ - TraitTypesPackage getTraitTypesPackage(); - -} //TraitTypesFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesPackage.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesPackage.java deleted file mode 100644 index 81b82fb5a..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/TraitTypesPackage.java +++ /dev/null @@ -1,395 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id$ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> - * The <b>Package</b> for the model. - * It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * - * <p><b>Provisional API - subject to change</b></p> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesFactory - * @model kind="package" - * @generated - */ -@SuppressWarnings("hiding") -public interface TraitTypesPackage extends EPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The package name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNAME = "traittypes"; //$NON-NLS-1$ - - /** - * The package namespace URI. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_URI = "http://org.eclipse.jst.jsf.common.metadata/metadataTraitTypes.ecore"; //$NON-NLS-1$ - - /** - * The package namespace name. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - String eNS_PREFIX = "mdt"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - TraitTypesPackage eINSTANCE = org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl.init(); - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl <em>List Of Values</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getListOfValues() - * @generated - */ - int LIST_OF_VALUES = 0; - - /** - * The feature id for the '<em><b>Entries</b></em>' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int LIST_OF_VALUES__ENTRIES = 0; - - /** - * The number of structural features of the '<em>List Of Values</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int LIST_OF_VALUES_FEATURE_COUNT = 1; - - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl <em>Set Generator</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getSetGenerator() - * @generated - */ - int SET_GENERATOR = 1; - - /** - * The feature id for the '<em><b>Algorithm</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SET_GENERATOR__ALGORITHM = 0; - - /** - * The feature id for the '<em><b>Expression</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SET_GENERATOR__EXPRESSION = 1; - - /** - * The number of structural features of the '<em>Set Generator</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int SET_GENERATOR_FEATURE_COUNT = 2; - - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl <em>String Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getStringValue() - * @generated - */ - int STRING_VALUE = 2; - - /** - * The feature id for the '<em><b>Value</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_VALUE__VALUE = 0; - - /** - * The number of structural features of the '<em>String Value</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int STRING_VALUE_FEATURE_COUNT = 1; - - /** - * The meta object id for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl <em>Boolean Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getBooleanValue() - * @generated - */ - int BOOLEAN_VALUE = 3; - - /** - * The feature id for the '<em><b>True</b></em>' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int BOOLEAN_VALUE__TRUE = 0; - - /** - * The number of structural features of the '<em>Boolean Value</em>' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int BOOLEAN_VALUE_FEATURE_COUNT = 1; - - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues <em>List Of Values</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>List Of Values</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues - * @generated - */ - EClass getListOfValues(); - - /** - * Returns the meta object for the containment reference list '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues#getEntries <em>Entries</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the containment reference list '<em>Entries</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues#getEntries() - * @see #getListOfValues() - * @generated - */ - EReference getListOfValues_Entries(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator <em>Set Generator</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Set Generator</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator - * @generated - */ - EClass getSetGenerator(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getAlgorithm <em>Algorithm</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Algorithm</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getAlgorithm() - * @see #getSetGenerator() - * @generated - */ - EAttribute getSetGenerator_Algorithm(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getExpression <em>Expression</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Expression</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator#getExpression() - * @see #getSetGenerator() - * @generated - */ - EAttribute getSetGenerator_Expression(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue <em>String Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>String Value</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue - * @generated - */ - EClass getStringValue(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue#getValue <em>Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>Value</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue#getValue() - * @see #getStringValue() - * @generated - */ - EAttribute getStringValue_Value(); - - /** - * Returns the meta object for class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue <em>Boolean Value</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for class '<em>Boolean Value</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue - * @generated - */ - EClass getBooleanValue(); - - /** - * Returns the meta object for the attribute '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue <em>True</em>}'. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the meta object for the attribute '<em>True</em>'. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue#isTrue() - * @see #getBooleanValue() - * @generated - */ - EAttribute getBooleanValue_True(); - - /** - * Returns the factory that creates the instances of the model. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the factory that creates the instances of the model. - * @generated - */ - TraitTypesFactory getTraitTypesFactory(); - - /** - * <!-- begin-user-doc --> - * Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * @generated - */ - interface Literals { - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl <em>List Of Values</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getListOfValues() - * @generated - */ - EClass LIST_OF_VALUES = eINSTANCE.getListOfValues(); - - /** - * The meta object literal for the '<em><b>Entries</b></em>' containment reference list feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EReference LIST_OF_VALUES__ENTRIES = eINSTANCE.getListOfValues_Entries(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl <em>Set Generator</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getSetGenerator() - * @generated - */ - EClass SET_GENERATOR = eINSTANCE.getSetGenerator(); - - /** - * The meta object literal for the '<em><b>Algorithm</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute SET_GENERATOR__ALGORITHM = eINSTANCE.getSetGenerator_Algorithm(); - - /** - * The meta object literal for the '<em><b>Expression</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute SET_GENERATOR__EXPRESSION = eINSTANCE.getSetGenerator_Expression(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl <em>String Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getStringValue() - * @generated - */ - EClass STRING_VALUE = eINSTANCE.getStringValue(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute STRING_VALUE__VALUE = eINSTANCE.getStringValue_Value(); - - /** - * The meta object literal for the '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl <em>Boolean Value</em>}' class. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.TraitTypesPackageImpl#getBooleanValue() - * @generated - */ - EClass BOOLEAN_VALUE = eINSTANCE.getBooleanValue(); - - /** - * The meta object literal for the '<em><b>True</b></em>' attribute feature. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - EAttribute BOOLEAN_VALUE__TRUE = eINSTANCE.getBooleanValue_True(); - - } - -} //TraitTypesPackage diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/BooleanValueImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/BooleanValueImpl.java deleted file mode 100644 index 4592f6a91..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/BooleanValueImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: BooleanValueImpl.java,v 1.1 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Boolean Value</b></em>'. - * - * Only String value of 'true' in xml will result in isTrue() being true. - * All other String values will result in false. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.BooleanValueImpl#isTrue <em>True</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class BooleanValueImpl extends EObjectImpl implements BooleanValue { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #isTrue() <em>True</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isTrue() - * @generated - * @ordered - */ - protected static final boolean TRUE_EDEFAULT = false; - - /** - * The cached value of the '{@link #isTrue() <em>True</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #isTrue() - * @generated - * @ordered - */ - protected boolean true_ = TRUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected BooleanValueImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.BOOLEAN_VALUE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean isTrue() { - return true_; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setTrue(boolean newTrue) { - boolean oldTrue = true_; - true_ = newTrue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TraitTypesPackage.BOOLEAN_VALUE__TRUE, oldTrue, true_)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - return isTrue() ? Boolean.TRUE : Boolean.FALSE; - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - setTrue(((Boolean)newValue).booleanValue()); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - setTrue(TRUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.BOOLEAN_VALUE__TRUE: - return true_ != TRUE_EDEFAULT; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (isTrue(): "); //$NON-NLS-1$ - result.append(true_); - result.append(')'); - return result.toString(); - } - -} //BooleanValueImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/ListOfValuesImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/ListOfValuesImpl.java deleted file mode 100644 index 4cbfe03dc..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/ListOfValuesImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: ListOfValuesImpl.java,v 1.4 2008/11/18 22:24:38 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; - -import org.eclipse.emf.common.util.EList; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; - -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; - -import org.eclipse.emf.ecore.xml.type.SimpleAnyType; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>List Of Values</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.ListOfValuesImpl#getEntries <em>Entries</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class ListOfValuesImpl extends EObjectImpl implements ListOfValues { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached value of the '{@link #getEntries() <em>Entries</em>}' containment reference list. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getEntries() - * @generated - * @ordered - */ - protected EList entries = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected ListOfValuesImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.LIST_OF_VALUES; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EList getEntries() { - if (entries == null) { - entries = new EObjectContainmentEList(SimpleAnyType.class, this, TraitTypesPackage.LIST_OF_VALUES__ENTRIES); - } - return entries; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - return ((InternalEList)getEntries()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - return getEntries(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - getEntries().clear(); - getEntries().addAll((Collection)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - getEntries().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.LIST_OF_VALUES__ENTRIES: - return entries != null && !entries.isEmpty(); - } - return super.eIsSet(featureID); - } - -} //ListOfValuesImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/SetGeneratorImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/SetGeneratorImpl.java deleted file mode 100644 index d12cb3ceb..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/SetGeneratorImpl.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: SetGeneratorImpl.java,v 1.3 2008/11/18 22:24:38 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>Set Generator</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl#getAlgorithm <em>Algorithm</em>}</li> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.SetGeneratorImpl#getExpression <em>Expression</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class SetGeneratorImpl extends EObjectImpl implements SetGenerator { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getAlgorithm() <em>Algorithm</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAlgorithm() - * @generated - * @ordered - */ - protected static final String ALGORITHM_EDEFAULT = null; - - /** - * The cached value of the '{@link #getAlgorithm() <em>Algorithm</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getAlgorithm() - * @generated - * @ordered - */ - protected String algorithm = ALGORITHM_EDEFAULT; - - /** - * The default value of the '{@link #getExpression() <em>Expression</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExpression() - * @generated - * @ordered - */ - protected static final String EXPRESSION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getExpression() <em>Expression</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getExpression() - * @generated - * @ordered - */ - protected String expression = EXPRESSION_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected SetGeneratorImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.SET_GENERATOR; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getAlgorithm() { - return algorithm; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setAlgorithm(String newAlgorithm) { - String oldAlgorithm = algorithm; - algorithm = newAlgorithm; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TraitTypesPackage.SET_GENERATOR__ALGORITHM, oldAlgorithm, algorithm)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getExpression() { - return expression; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setExpression(String newExpression) { - String oldExpression = expression; - expression = newExpression; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TraitTypesPackage.SET_GENERATOR__EXPRESSION, oldExpression, expression)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - return getAlgorithm(); - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - return getExpression(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - setAlgorithm((String)newValue); - return; - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - setExpression((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - setAlgorithm(ALGORITHM_EDEFAULT); - return; - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - setExpression(EXPRESSION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.SET_GENERATOR__ALGORITHM: - return ALGORITHM_EDEFAULT == null ? algorithm != null : !ALGORITHM_EDEFAULT.equals(algorithm); - case TraitTypesPackage.SET_GENERATOR__EXPRESSION: - return EXPRESSION_EDEFAULT == null ? expression != null : !EXPRESSION_EDEFAULT.equals(expression); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (algorithm: "); //$NON-NLS-1$ - result.append(algorithm); - result.append(", expression: "); //$NON-NLS-1$ - result.append(expression); - result.append(')'); - return result.toString(); - } - -} //SetGeneratorImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/StringValueImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/StringValueImpl.java deleted file mode 100644 index 89f502664..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/StringValueImpl.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Copyright (c) 2007 Oracle Corporation - * - * $Id: StringValueImpl.java,v 1.1 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl; - -import org.eclipse.emf.common.notify.Notification; - -import org.eclipse.emf.ecore.EClass; - -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model object '<em><b>String Value</b></em>'. - * <!-- end-user-doc --> - * <p> - * The following features are implemented: - * <ul> - * <li>{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl.StringValueImpl#getValue <em>Value</em>}</li> - * </ul> - * </p> - * - * @generated - */ -public class StringValueImpl extends EObjectImpl implements StringValue { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The default value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected static final String VALUE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see #getValue() - * @generated - * @ordered - */ - protected String value = VALUE_EDEFAULT; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected StringValueImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected EClass eStaticClass() { - return TraitTypesPackage.Literals.STRING_VALUE; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public String getValue() { - return value; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void setValue(String newValue) { - String oldValue = value; - value = newValue; - if (eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, TraitTypesPackage.STRING_VALUE__VALUE, oldValue, value)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case TraitTypesPackage.STRING_VALUE__VALUE: - return getValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case TraitTypesPackage.STRING_VALUE__VALUE: - setValue((String)newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void eUnset(int featureID) { - switch (featureID) { - case TraitTypesPackage.STRING_VALUE__VALUE: - setValue(VALUE_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public boolean eIsSet(int featureID) { - switch (featureID) { - case TraitTypesPackage.STRING_VALUE__VALUE: - return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated NOT - */ - public String toString() { - if (eIsProxy()) return super.toString(); - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (value: "); //$NON-NLS-1$ - result.append(value); - result.append(')'); - return result.toString(); - } - -} //StringValueImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesFactoryImpl.java deleted file mode 100644 index c8441843e..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesFactoryImpl.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesFactoryImpl.java,v 1.8 2010/03/01 18:10:08 cbateman Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.impl.EFactoryImpl; - -import org.eclipse.emf.ecore.plugin.EcorePlugin; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.*; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Factory</b>. - * <!-- end-user-doc --> - * @generated - */ -public class TraitTypesFactoryImpl extends EFactoryImpl implements TraitTypesFactory { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates the default factory implementation. - * <!-- begin-user-doc --> - * @return the factory - * <!-- end-user-doc --> - * @generated NOT - */ - public static TraitTypesFactory init() { - try { - TraitTypesFactory theTraitTypesFactory = (TraitTypesFactory)EPackage.Registry.INSTANCE.getEFactory("http://org.eclipse.jst.jsf.common.metadata/metadataTraitTypes.ecore"); //$NON-NLS-1$ - if (theTraitTypesFactory != null) { - return theTraitTypesFactory; - } - } - catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new TraitTypesFactoryImpl(); - } - - /** - * Creates an instance of the factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case TraitTypesPackage.LIST_OF_VALUES: return createListOfValues(); - case TraitTypesPackage.SET_GENERATOR: return createSetGenerator(); - case TraitTypesPackage.STRING_VALUE: return createStringValue(); - case TraitTypesPackage.BOOLEAN_VALUE: return createBooleanValue(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public ListOfValues createListOfValues() { - ListOfValuesImpl listOfValues = new ListOfValuesImpl(); - return listOfValues; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public SetGenerator createSetGenerator() { - SetGeneratorImpl setGenerator = new SetGeneratorImpl(); - return setGenerator; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public StringValue createStringValue() { - StringValueImpl stringValue = new StringValueImpl(); - return stringValue; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public BooleanValue createBooleanValue() { - BooleanValueImpl booleanValue = new BooleanValueImpl(); - return booleanValue; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesPackage getTraitTypesPackage() { - return (TraitTypesPackage)getEPackage(); - } - - /** - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @deprecated - * @generated - */ - public static TraitTypesPackage getPackage() { - return TraitTypesPackage.eINSTANCE; - } - -} //TraitTypesFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesPackageImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesPackageImpl.java deleted file mode 100644 index 80dfaae01..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/impl/TraitTypesPackageImpl.java +++ /dev/null @@ -1,358 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesPackageImpl.java,v 1.8 2010/03/01 18:10:07 cbateman Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -import org.eclipse.emf.ecore.impl.EPackageImpl; - -import org.eclipse.emf.ecore.xml.type.XMLTypePackage; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesFactory; -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * <!-- begin-user-doc --> - * An implementation of the model <b>Package</b>. - * <!-- end-user-doc --> - * @generated - */ -public class TraitTypesPackageImpl extends EPackageImpl implements TraitTypesPackage { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass listOfValuesEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass setGeneratorEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass stringValueEClass = null; - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private EClass booleanValueEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with - * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package - * package URI value. - * <p>Note: the correct way to create the package is via the static - * factory method {@link #init init()}, which also performs - * initialization of the package, or returns the registered package, - * if one already exists. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage#eNS_URI - * @see #init() - * @generated - */ - private TraitTypesPackageImpl() { - super(eNS_URI, TraitTypesFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p>This method is used to initialize {@link TraitTypesPackage#eINSTANCE} when that field is accessed. - * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. - * <!-- begin-user-doc --> - * @return the package - * <!-- end-user-doc --> - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static TraitTypesPackage init() { - if (isInited) return (TraitTypesPackage)EPackage.Registry.INSTANCE.getEPackage(TraitTypesPackage.eNS_URI); - - // Obtain or create and register package - TraitTypesPackageImpl theTraitTypesPackage = (TraitTypesPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TraitTypesPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new TraitTypesPackageImpl()); - - isInited = true; - - // Initialize simple dependencies - XMLTypePackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theTraitTypesPackage.createPackageContents(); - - // Initialize created meta-data - theTraitTypesPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theTraitTypesPackage.freeze(); - - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(TraitTypesPackage.eNS_URI, theTraitTypesPackage); - return theTraitTypesPackage; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getListOfValues() { - return listOfValuesEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EReference getListOfValues_Entries() { - return (EReference)listOfValuesEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getSetGenerator() { - return setGeneratorEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getSetGenerator_Algorithm() { - return (EAttribute)setGeneratorEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getSetGenerator_Expression() { - return (EAttribute)setGeneratorEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getStringValue() { - return stringValueEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getStringValue_Value() { - return (EAttribute)stringValueEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EClass getBooleanValue() { - return booleanValueEClass; - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public EAttribute getBooleanValue_True() { - return (EAttribute)booleanValueEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesFactory getTraitTypesFactory() { - return (TraitTypesFactory)getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is - * guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void createPackageContents() { - if (isCreated) return; - isCreated = true; - - // Create classes and their features - listOfValuesEClass = createEClass(LIST_OF_VALUES); - createEReference(listOfValuesEClass, LIST_OF_VALUES__ENTRIES); - - setGeneratorEClass = createEClass(SET_GENERATOR); - createEAttribute(setGeneratorEClass, SET_GENERATOR__ALGORITHM); - createEAttribute(setGeneratorEClass, SET_GENERATOR__EXPRESSION); - - stringValueEClass = createEClass(STRING_VALUE); - createEAttribute(stringValueEClass, STRING_VALUE__VALUE); - - booleanValueEClass = createEClass(BOOLEAN_VALUE); - createEAttribute(booleanValueEClass, BOOLEAN_VALUE__TRUE); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This - * method is guarded to have no affect on any invocation but its first. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public void initializePackageContents() { - if (isInitialized) return; - isInitialized = true; - - // Initialize package - setName(eNAME); - setNsPrefix(eNS_PREFIX); - setNsURI(eNS_URI); - - // Obtain other dependent packages - XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); - - // Add supertypes to classes - - // Initialize classes and features; add operations and parameters - initEClass(listOfValuesEClass, ListOfValues.class, "ListOfValues", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getListOfValues_Entries(), theXMLTypePackage.getSimpleAnyType(), null, "entries", null, 0, -1, ListOfValues.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(setGeneratorEClass, SetGenerator.class, "SetGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getSetGenerator_Algorithm(), ecorePackage.getEString(), "algorithm", null, 0, 1, SetGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - initEAttribute(getSetGenerator_Expression(), ecorePackage.getEString(), "expression", null, 0, 1, SetGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(stringValueEClass, StringValue.class, "StringValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getStringValue_Value(), ecorePackage.getEString(), "value", null, 1, 1, StringValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - initEClass(booleanValueEClass, BooleanValue.class, "BooleanValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getBooleanValue_True(), ecorePackage.getEBoolean(), "true", null, 1, 1, BooleanValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ - - // Create resource - createResource(eNS_URI); - - // Create annotations - // http:///org/eclipse/emf/ecore/util/ExtendedMetaData - createExtendedMetaDataAnnotations(); - } - - /** - * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected void createExtendedMetaDataAnnotations() { - String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; //$NON-NLS-1$ - addAnnotation - (getListOfValues_Entries(), - source, - new String[] { - "kind", "element", //$NON-NLS-1$ //$NON-NLS-2$ - "name", "item" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getSetGenerator_Algorithm(), - source, - new String[] { - "kind", "element" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getSetGenerator_Expression(), - source, - new String[] { - "kind", "element" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (stringValueEClass, - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getStringValue_Value(), - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (booleanValueEClass, - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - addAnnotation - (getBooleanValue_True(), - source, - new String[] { - "kind", "simple" //$NON-NLS-1$ //$NON-NLS-2$ - }); - } - -} //TraitTypesPackageImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesAdapterFactory.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesAdapterFactory.java deleted file mode 100644 index dd1e6533f..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesAdapterFactory.java +++ /dev/null @@ -1,178 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesAdapterFactory.java,v 1.6 2010/01/21 00:01:44 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; - -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.*; - -/** - * <!-- begin-user-doc --> - * The <b>Adapter Factory</b> for the model. - * It provides an adapter <code>createXXX</code> method for each class of the model. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage - * @generated - */ -public class TraitTypesAdapterFactory extends AdapterFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static TraitTypesPackage modelPackage; - - /** - * Creates an instance of the adapter factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesAdapterFactory() { - if (modelPackage == null) { - modelPackage = TraitTypesPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. - * <!-- begin-user-doc --> - * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. - * <!-- end-user-doc --> - * @return whether this factory is applicable for the type of the object. - * @generated - */ - public boolean isFactoryForType(Object object) { - if (object == modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject)object).eClass().getEPackage() == modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected TraitTypesSwitch modelSwitch = - new TraitTypesSwitch() { - public Object caseListOfValues(ListOfValues object) { - return createListOfValuesAdapter(); - } - public Object caseSetGenerator(SetGenerator object) { - return createSetGeneratorAdapter(); - } - public Object caseStringValue(StringValue object) { - return createStringValueAdapter(); - } - public Object caseBooleanValue(BooleanValue object) { - return createBooleanValueAdapter(); - } - public Object defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param target the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - public Adapter createAdapter(Notifier target) { - return (Adapter)modelSwitch.doSwitch((EObject)target); - } - - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues <em>List Of Values</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.ListOfValues - * @generated - */ - public Adapter createListOfValuesAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator <em>Set Generator</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.SetGenerator - * @generated - */ - public Adapter createSetGeneratorAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue <em>String Value</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.StringValue - * @generated - */ - public Adapter createStringValueAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class '{@link org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue <em>Boolean Value</em>}'. - * <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; - * it's useful to ignore a case when inheritance will catch all the cases anyway. - * <!-- end-user-doc --> - * @return the new adapter. - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.BooleanValue - * @generated - */ - public Adapter createBooleanValueAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. - * <!-- begin-user-doc --> - * This default implementation returns null. - * <!-- end-user-doc --> - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} //TraitTypesAdapterFactory diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceFactoryImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceFactoryImpl.java deleted file mode 100644 index 2c56283cf..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceFactoryImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesResourceFactoryImpl.java,v 1.4 2008/11/18 22:24:43 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.resource.Resource; - -import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl; - -import org.eclipse.emf.ecore.xmi.XMLResource; - -/** - * <!-- begin-user-doc --> - * The <b>Resource Factory</b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util.TraitTypesResourceImpl - * @generated - */ -public class TraitTypesResourceFactoryImpl extends ResourceFactoryImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates an instance of the resource factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesResourceFactoryImpl() { - super(); - } - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public Resource createResource(URI uri) { - XMLResource result = new TraitTypesResourceImpl(uri); - result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - - result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE); - - result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE); - return result; - } - -} //TraitTypesResourceFactoryImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceImpl.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceImpl.java deleted file mode 100644 index 894006d12..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesResourceImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesResourceImpl.java,v 1.4 2008/11/18 22:24:43 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl; - -/** - * <!-- begin-user-doc --> - * The <b>Resource </b> associated with the package. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util.TraitTypesResourceFactoryImpl - * @generated - */ -public class TraitTypesResourceImpl extends XMLResourceImpl { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * Creates an instance of the resource. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @param uri the URI of the new resource. - * @generated - */ - public TraitTypesResourceImpl(URI uri) { - super(uri); - } - -} //TraitTypesResourceImpl diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesSwitch.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesSwitch.java deleted file mode 100644 index 0947b7048..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesSwitch.java +++ /dev/null @@ -1,203 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesSwitch.java,v 1.9 2010/03/01 18:10:08 cbateman Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.*; - -/** - * <!-- begin-user-doc --> - * The <b>Switch</b> for the model's inheritance hierarchy. - * It supports the call {@link #doSwitch(EObject) doSwitch(object)} - * to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object - * and proceeding up the inheritance hierarchy - * until a non-null result is returned, - * which is the result of the switch. - * <!-- end-user-doc --> - * @see org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage - * @generated - */ -public class TraitTypesSwitch { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - /** - * The cached model package - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected static TraitTypesPackage modelPackage; - - /** - * Creates an instance of the switch. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesSwitch() { - if (modelPackage == null) { - modelPackage = TraitTypesPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public Object doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param theEClass - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } - List eSuperTypes = theEClass.getESuperTypes(); - return - eSuperTypes.isEmpty() ? - defaultCase(theEObject) : - doSwitch((EClass)eSuperTypes.get(0), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * @param classifierID - * @param theEObject - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected Object doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case TraitTypesPackage.LIST_OF_VALUES: { - ListOfValues listOfValues = (ListOfValues)theEObject; - Object result = caseListOfValues(listOfValues); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TraitTypesPackage.SET_GENERATOR: { - SetGenerator setGenerator = (SetGenerator)theEObject; - Object result = caseSetGenerator(setGenerator); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TraitTypesPackage.STRING_VALUE: { - StringValue stringValue = (StringValue)theEObject; - Object result = caseStringValue(stringValue); - if (result == null) result = defaultCase(theEObject); - return result; - } - case TraitTypesPackage.BOOLEAN_VALUE: { - BooleanValue booleanValue = (BooleanValue)theEObject; - Object result = caseBooleanValue(booleanValue); - if (result == null) result = defaultCase(theEObject); - return result; - } - default: return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of '<em>List Of Values</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>List Of Values</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseListOfValues(ListOfValues object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Set Generator</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Set Generator</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseSetGenerator(SetGenerator object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>String Value</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>String Value</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseStringValue(StringValue object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>Boolean Value</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>Boolean Value</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public Object caseBooleanValue(BooleanValue object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. - * <!-- begin-user-doc --> - * This implementation returns null; - * returning a non-null result will terminate the switch, but this is the last case anyway. - * <!-- end-user-doc --> - * @param object the target of the switch. - * @return the result of interpreting the object as an instance of '<em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public Object defaultCase(EObject object) { - return null; - } - -} //TraitTypesSwitch diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesXMLProcessor.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesXMLProcessor.java deleted file mode 100644 index 674a2dd3c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/internal/util/TraitTypesXMLProcessor.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * <copyright> - * </copyright> - * - * $Id: TraitTypesXMLProcessor.java,v 1.5 2008/11/18 22:24:43 gkessler Exp $ - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.internal.util; - -import java.util.Map; - -import org.eclipse.emf.ecore.EPackage; - -import org.eclipse.emf.ecore.xmi.util.XMLProcessor; - -import org.eclipse.jst.jsf.common.metadata.traittypes.traittypes.TraitTypesPackage; - -/** - * This class contains helper methods to serialize and deserialize XML documents - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ -public class TraitTypesXMLProcessor extends XMLProcessor { - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public static final String copyright = "Copyright (c) 2007 Oracle Corporation"; //$NON-NLS-1$ - - - /** - * Public constructor to instantiate the helper. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - public TraitTypesXMLProcessor() { - super((EPackage.Registry.INSTANCE)); - TraitTypesPackage.eINSTANCE.eClass(); - } - - /** - * Register for "*" and "xml" file extensions the TraitTypesResourceFactoryImpl factory. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - */ - protected Map getRegistrations() { - if (registrations == null) { - super.getRegistrations(); - registrations.put(XML_EXTENSION, new TraitTypesResourceFactoryImpl()); - registrations.put(STAR_EXTENSION, new TraitTypesResourceFactoryImpl()); - } - return registrations; - } - -} //TraitTypesXMLProcessor diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/package-info.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/package-info.java deleted file mode 100644 index 76e224562..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/traittypes/traittypes/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -/** - * Common meta-data traits. - * <p><b>Provisional API - subject to change</b></p> - */ -package org.eclipse.jst.jsf.common.metadata.traittypes.traittypes; |