@NotStorableClass public abstract class AbstractImporter extends Object implements IImporter
| Modifier and Type | Field and Description |
|---|---|
protected ClassLoaderProvider |
classLoaderProvider |
protected JoafipLogger |
logger |
| Constructor and Description |
|---|
AbstractImporter(IStore store) |
| Modifier and Type | Method and Description |
|---|---|
protected ClassDef |
classDefForClass(Class<?> clazz) |
protected ClassDef |
classForName(String className) |
protected ClassDef |
classReplacementDef(ClassInfo classInfo) |
protected ValuedFieldList |
convert(ValuedFieldList valuedFieldList,
Deque<ClassReplacementDef> replacementDef,
FieldInfo[] fieldInfos) |
Object |
createArray(Class<?> componentClass,
int objectIdentifier,
int size)
create an array instance
|
ObjectModelForImport |
createArray(ClassDef componentClassDef,
DataRecordIdentifier dataRecordIdentifier,
int arraySize)
create an array instance
|
ObjectModelForImport |
createBasicValue(ClassDef classDef,
String value,
boolean createDataRecordIdentifierIfNeeded)
create a basic object value ( primitive or class associated to primitive
type )
|
protected DataRecordIdentifier |
createDataRecordIdentifierAssociatedToObject(Object object)
allocate a new data record identifier for an object
|
ObjectModelForImport |
createDummyValueObject(ClassDef classDef,
DataRecordIdentifier dataRecordIdentifier)
create a dummy object for specified argument class, class can be abstract
or interface
|
Object |
createEnum(ClassDef classDef,
int objectIdentifier,
String constantName)
create enum object instance.
|
ObjectModelForImport |
createEnum(DataRecordIdentifier dataRecordIdentifier,
ClassDef classDef,
String constantName)
create enum object instance.
|
Object |
createObject(ClassDef classDef,
int objectIdentifier)
create object instance, construction in memory without calling
constructor
|
ObjectModelForImport |
createObject(DataRecordIdentifier dataRecordIdentifier,
ClassDef classDef)
Create object instance, construction in memory without calling
constructor.
|
ObjectModelForImport |
createRootObject() |
Object |
createString(DataRecordIdentifier dataRecordIdentifier,
String string) |
ObjectModelForImport |
createString(int objectIdentifier,
String string) |
void |
doImport(String directoryName,
boolean validating)
import from exported data in
directoryName |
ClassInfoFactory |
getClassInfoFactory() |
protected ClassDef |
getClassReplacementDef(Class<?> clazz) |
Object |
getObject(int objectIdentifier) |
int |
getPreviousDataModelIdentifier() |
int |
getPreviousRelesase() |
protected abstract void |
importImpl(File directory,
boolean validating)
specific implementation of import from exported data in
directoryName |
protected boolean |
isBasicClass(Class<?> clazz)
test is class is basic class ( primitive or class associated to primitive
)
|
DataRecordIdentifier |
newDataRecordIdentifier(String value) |
void |
recordObject(Object object) |
void |
recordObject(Object object,
boolean stateSet,
ClassInfo classInfo,
ValuedFieldList valuedFieldList)
record objects
|
void |
setArrayElement(ObjectModelForImport arrayObjectModel,
int index,
Object elementValue) |
protected ObjectAndPersistInfo |
setDataRecordIdentifierAssociatedToObject(Object object,
DataRecordIdentifier dataRecordIdentifier)
set the data record identifier of an object
|
protected void |
setLastRecordId(long lastRecordId)
to set last data record identifier from import data
|
void |
setListener(IImportListener listener) |
void |
setObjectState(Object object,
ClassInfo classInfo,
ValuedFieldList valuedFieldList) |
protected void |
setReleaseAndDataModelIdentifier(String previousReleaseName,
int previousDataModelIdentifier) |
protected final JoafipLogger logger
protected final ClassLoaderProvider classLoaderProvider
public AbstractImporter(IStore store) throws ImportException
ImportExceptionpublic void setListener(IImportListener listener)
setListener in interface IImporterpublic ClassInfoFactory getClassInfoFactory()
public void doImport(String directoryName, boolean validating) throws ImportException, ImportClassNotFoundException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException
IImporterdirectoryName directory
doImport in interface IImporterdirectoryName - directory name where are stored exported data to importImportExceptionImportClassNotFoundExceptionImportDataCorruptedExceptionImportInvalidClassExceptionImportNotSerializableExceptionprotected abstract void importImpl(File directory, boolean validating) throws ImportException, ImportClassNotFoundException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException
directoryName directory
directoryName - directory name where are stored exported data to importvalidating - true if validating according to joafip.xsdImportExceptionImportClassNotFoundExceptionImportDataCorruptedExceptionImportInvalidClassExceptionImportNotSerializableExceptionprotected void setReleaseAndDataModelIdentifier(String previousReleaseName, int previousDataModelIdentifier) throws ImportException
ImportExceptionpublic int getPreviousDataModelIdentifier()
public int getPreviousRelesase()
protected void setLastRecordId(long lastRecordId)
throws ImportException
lastRecordId - StoreExceptionImportExceptionpublic ObjectModelForImport createRootObject() throws ImportException
ImportExceptionpublic ObjectModelForImport createDummyValueObject(ClassDef classDef, DataRecordIdentifier dataRecordIdentifier) throws ImportException
classDef - the class definition of class which for an object is to be
createddataRecordIdentifier - the data record identifier to associate to this objectImportExceptionpublic ObjectModelForImport createObject(DataRecordIdentifier dataRecordIdentifier, ClassDef classDef) throws ImportException
NullMarker instance if class does not existdataRecordIdentifier - data record identifier of the objectclassDef - the object class definitionImportExceptionpublic Object createObject(ClassDef classDef, int objectIdentifier) throws ImportException
classDef - the object class definitionobjectIdentifier - the object identifier of this objectImportExceptionpublic Object getObject(int objectIdentifier)
public ObjectModelForImport createEnum(DataRecordIdentifier dataRecordIdentifier, ClassDef classDef, String constantName) throws ImportException, ImportInvalidClassException
dataRecordIdentifier - classDef - constantName - ImportExceptionImportInvalidClassExceptionpublic Object createEnum(ClassDef classDef, int objectIdentifier, String constantName) throws ImportException
classDef - the enum object class definitionobjectIdentifier - the object identifier of this enum objectconstantName - ImportExceptionpublic ObjectModelForImport createArray(ClassDef componentClassDef, DataRecordIdentifier dataRecordIdentifier, int arraySize) throws ImportException
componentClassDef - the array component class definitiondataRecordIdentifier - the data record identifier to associate to this arrayarraySize - the array number of elementsImportExceptionpublic Object createArray(Class<?> componentClass, int objectIdentifier, int size) throws ImportException
componentClass - the array component classobjectIdentifier - the identifier of this arraysize - the array number of elementsImportExceptionpublic Object createString(DataRecordIdentifier dataRecordIdentifier, String string) throws ImportException
dataRecordIdentifier - the data record identifier to associate to this stringstring - the stringImportExceptionpublic ObjectModelForImport createString(int objectIdentifier, String string) throws ImportException
objectIdentifier - the identifier of this stringstring - the stringImportExceptionpublic ObjectModelForImport createBasicValue(ClassDef classDef, String value, boolean createDataRecordIdentifierIfNeeded) throws ImportException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException, ImportClassNotFoundException
valueClass - the class of the valuevalue - the valuecreateDataRecordIdentifierIfNeeded - if true and a not primitive created then associate a data
record identifier to instance createdImportExceptionImportClassNotFoundExceptionImportNotSerializableExceptionImportInvalidClassExceptionImportDataCorruptedExceptionprotected DataRecordIdentifier createDataRecordIdentifierAssociatedToObject(Object object) throws ImportException
object - the object that need to be associated to a new data record
identifierImportExceptionprotected ObjectAndPersistInfo setDataRecordIdentifierAssociatedToObject(Object object, DataRecordIdentifier dataRecordIdentifier) throws ImportException
object - the objectdataRecordIdentifier - the object data record identifierImportExceptionpublic void setArrayElement(ObjectModelForImport arrayObjectModel, int index, Object elementValue) throws ImportException
ImportExceptionprotected boolean isBasicClass(Class<?> clazz) throws ImportException
clazz - the classImportExceptionprotected ValuedFieldList convert(ValuedFieldList valuedFieldList, Deque<ClassReplacementDef> replacementDef, FieldInfo[] fieldInfos) throws ImportException
ImportExceptionpublic void recordObject(Object object, boolean stateSet, ClassInfo classInfo, ValuedFieldList valuedFieldList) throws ImportException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException, ImportClassNotFoundException, ImportTooBigForSerializationException
object - stateSet - classInfo - valuedFieldList - ImportExceptionImportClassNotFoundExceptionImportNotSerializableExceptionImportInvalidClassExceptionImportDataCorruptedExceptionImportTooBigForSerializationExceptionStoreTooBigForSerializationExceptionpublic void setObjectState(Object object, ClassInfo classInfo, ValuedFieldList valuedFieldList) throws ImportException
ImportExceptionpublic void recordObject(Object object) throws ImportException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException, ImportClassNotFoundException, ImportTooBigForSerializationException
protected ClassDef getClassReplacementDef(Class<?> clazz) throws ImportException
ImportExceptionprotected ClassDef classForName(String className) throws ImportException, ImportClassNotFoundException
className - the class nameImportExceptionImportClassNotFoundExceptionprotected ClassDef classReplacementDef(ClassInfo classInfo) throws ClassInfoException
ClassInfoExceptionprotected final ClassDef classDefForClass(Class<?> clazz) throws ImportException
ImportExceptionpublic DataRecordIdentifier newDataRecordIdentifier(String value) throws ImportException
value - text form of data record identifier, may be nullImportExceptionCopyright © 2007-2012 Luc Peuvrier. All Rights Reserved.