/**
* Copyright (C) 2001-2004 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.objectweb.speedo.generation.jorm;
import org.objectweb.jorm.api.PException;
import org.objectweb.jorm.metainfo.api.Class;
import org.objectweb.jorm.metainfo.api.ClassMapping;
import org.objectweb.jorm.metainfo.api.GenClassMapping;
import org.objectweb.jorm.metainfo.api.GenClassRef;
import org.objectweb.jorm.metainfo.api.Mapping;
import org.objectweb.jorm.metainfo.api.NameDef;
import org.objectweb.jorm.metainfo.api.PrimitiveElement;
import org.objectweb.jorm.metainfo.api.PrimitiveElementMapping;
import org.objectweb.speedo.api.SpeedoException;
import org.objectweb.speedo.metadata.SpeedoClass;
import org.objectweb.speedo.metadata.SpeedoCommonField;
import org.objectweb.speedo.metadata.SpeedoField;
import org.objectweb.speedo.metadata.SpeedoInheritedField;
import org.objectweb.speedo.metadata.SpeedoNoFieldColumn;
import org.objectweb.speedo.naming.api.MIBuilderHelper;
/**
* This interface defines a builder of the mapping part of the Jorm meta
* information. It must be implemented for each mapper.
*
* @author S.Chassande-Barrioz
*/
public interface JormMIMappingBuilder {
/**
* It builds a ClassMapping, assignes it to the mapping and builds
* mapping structure for the class (RdbTable, directory name, ...).
* @param clazz is the Jorm meta object representing the class which the
* ClassMapping must be built.
* @param mapping is the Mapping instance which will host the ClassMapping.
* @return the ClassMapping instance built by the method (never null).
* @throws PException if it is not possible to build the ClassMapping
*/
ClassMapping createClassMapping(Class clazz,
SpeedoClass sc,
Mapping mapping)
throws PException, SpeedoException ;
/**
* It builds a GenClassMapping, assignes it to the mapping and builds
* mapping structure for the class (RdbTable, directory name, ...).
* @param gcr is the Jorm meta object representing the gen class which the
* GenClassMapping must be built.
* @param mapping is the Mapping instance which will host the GenClassMapping.
* @param sf is the SpeedoField corresponding to the generic class.
* @return the GenClassMapping instance built by the method (never null).
* @throws PException if it is not possible to build the GenClassMapping
*/
GenClassMapping createGenClassMapping(GenClassRef gcr,
SpeedoField sf,
Mapping mapping)
throws PException, SpeedoException ;
/**
* It creates the mapping of a primitive field.
* @param pe is the Jorm meta object representing a primitive field
* @param cm is the MappingStructure which will host the mapping of the
* field
* @return a PrimitiveElementMapping corresponding to the given primitive
* field.
* @throws PException if it is not possible to build the mapping of the
* primitive field.
*/
PrimitiveElementMapping createFieldMapping(PrimitiveElement pe,
SpeedoField sf,
ClassMapping cm)
throws PException, SpeedoException ;
/**
* It creates the mapping of a hidden primitive field.
* @param pe is the Jorm meta object representing a primitive field
* @param cm is the MappingStructure which will host the mapping of the
* field
* @return a PrimitiveElementMapping corresponding to the given primitive
* field.
* @throws PException if it is not possible to build the mapping of the
* primitive field.
*/
PrimitiveElementMapping createFieldMapping(PrimitiveElement pe,
SpeedoNoFieldColumn sf,
ClassMapping cm)
throws PException, SpeedoException ;
/**
/**
* It creates the mapping of an inherited primitive field.
* @param pe is the Jorm meta object representing a primitive field
* @param sif is the SpeedoInheritedField meta object representing the
* inherited field.
* @param cm is the MappingStructure which will host the mapping of the
* field
* @return a PrimitiveElementMapping corresponding to the given primitive
* field.
*/
PrimitiveElementMapping createFieldMapping(PrimitiveElement pe,
SpeedoInheritedField sif,
ClassMapping cm)
throws PException, SpeedoException ;
/**
* It creates the mapping of a primitive field (element of the generic
* class).
* @param pe is the Jorm meta object representing a primitive field
* @param gcm is the MappingStructure which will host the mapping of the
* field
* @param sf is the Speedo meta object representing the persistent field
* referencing a generic class.
* @return a PrimitiveElementMapping corresponding to the given primitive
* field.
* @throws PException if it is not possible to build the mapping of the
* primitive field.
*/
PrimitiveElementMapping createGenClassElementMapping(PrimitiveElement pe,
SpeedoField sf,
GenClassMapping gcm)
throws PException, SpeedoException ;
/**
* It creates the mapping of a primitive field used as index in the generic
* class.
* @param pe is the Jorm meta object representing a primitive field
* @param gcm is the MappingStructure which will host the mapping of the
* field
* @param sf is the Speedo meta object representing the persistent field
* referencing a generic class.
* @return a PrimitiveElementMapping corresponding to the given primitive
* field.
* @throws PException if it is not possible to build the mapping of the
* primitive field.
*/
PrimitiveElementMapping createGenClassIndexMapping(PrimitiveElement pe,
SpeedoField sf,
GenClassMapping gcm)
throws PException, SpeedoException ;
/**
* Creates the mapping of the name def (JORM meta object) corresponding to
* the identifier of a persistent generic class (collection, map, ...).
* @param cm is the MappingStructure which will host the mapping of the
* generic class
* @param nd is the namedef corresponding to the identifier of the
* generic class
* @param sc is the Speedo meta object representing the persistent class.
*/
void createClassIdentifierNameDefMapping(ClassMapping cm,
NameDef nd,
SpeedoClass sc,
MIBuilderHelper mibh) throws PException, SpeedoException;
/**
* Creates the mapping of the name def (JORM meta object) corresponding to
* the identifier of a persistent generic class (collection, map, ...).
* @param gcm is the MappingStructure which will host the mapping of the
* generic class
* @param nd is the namedef corresponding to the identifier of the
* generic class
* @param sf is the Speedo meta object representing the persistent field
* referencing a generic class.
*/
void createGenClassIdentifierNameDefMapping(GenClassMapping gcm,
NameDef nd,
SpeedoField sf,
MIBuilderHelper mibh) throws PException, SpeedoException;
/**
* Creates the mapping of the name def (JORM meta object) corresponding to
* a reference to a persistent class from a persistent class.
* @param cm is the MappingStructure which will host the mapping of the
* reference
* @param nd is the namedef corresponding to the reference
* @param sf is the Speedo meta object representing the persistent field
* referencing a class.
*/
void createClassRefNameDefMapping(ClassMapping cm,
NameDef nd,
SpeedoCommonField sf) throws PException, SpeedoException;
/**
* Creates the mapping of the name def (JORM meta object) corresponding to
* a reference to a persistent class from a generic persistent class.
* @param gcm is the MappingStructure which will host the mapping of the
* reference
* @param nd is the namedef corresponding to the reference
* @param sf is the Speedo meta object representing the persistent field
* referencing a generic class.
*/
void createClassRefNameDefMapping(GenClassMapping gcm,
NameDef nd,
SpeedoField sf) throws PException, SpeedoException;
/**
* Creates the mapping of the name def (JORM meta object) corresponding to
* a reference to a persistent generic class.
* @param cm is the MappingStructure which will host the mapping of the
* reference
* @param nd is the namedef corresponding to the reference
* @param sf is the Speedo meta object representing the persistent field
* referencing a generic class.
*/
void createGenClassRefNameDefMapping(ClassMapping cm,
NameDef nd,
SpeedoCommonField sf) throws PException, SpeedoException;
}
|