@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
ImportException
public void setListener(IImportListener listener)
setListener
in interface IImporter
public ClassInfoFactory getClassInfoFactory()
public void doImport(String directoryName, boolean validating) throws ImportException, ImportClassNotFoundException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException
IImporter
directoryName directory
doImport
in interface IImporter
directoryName
- directory name where are stored exported data to importImportException
ImportClassNotFoundException
ImportDataCorruptedException
ImportInvalidClassException
ImportNotSerializableException
protected 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.xsdImportException
ImportClassNotFoundException
ImportDataCorruptedException
ImportInvalidClassException
ImportNotSerializableException
protected void setReleaseAndDataModelIdentifier(String previousReleaseName, int previousDataModelIdentifier) throws ImportException
ImportException
public int getPreviousDataModelIdentifier()
public int getPreviousRelesase()
protected void setLastRecordId(long lastRecordId) throws ImportException
lastRecordId
- StoreException
ImportException
public ObjectModelForImport createRootObject() throws ImportException
ImportException
public 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 objectImportException
public ObjectModelForImport createObject(DataRecordIdentifier dataRecordIdentifier, ClassDef classDef) throws ImportException
NullMarker
instance if class does not existdataRecordIdentifier
- data record identifier of the objectclassDef
- the object class definitionImportException
public Object createObject(ClassDef classDef, int objectIdentifier) throws ImportException
classDef
- the object class definitionobjectIdentifier
- the object identifier of this objectImportException
public Object getObject(int objectIdentifier)
public ObjectModelForImport createEnum(DataRecordIdentifier dataRecordIdentifier, ClassDef classDef, String constantName) throws ImportException, ImportInvalidClassException
dataRecordIdentifier
- classDef
- constantName
- ImportException
ImportInvalidClassException
public Object createEnum(ClassDef classDef, int objectIdentifier, String constantName) throws ImportException
classDef
- the enum object class definitionobjectIdentifier
- the object identifier of this enum objectconstantName
- ImportException
public 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 elementsImportException
public Object createArray(Class<?> componentClass, int objectIdentifier, int size) throws ImportException
componentClass
- the array component classobjectIdentifier
- the identifier of this arraysize
- the array number of elementsImportException
public Object createString(DataRecordIdentifier dataRecordIdentifier, String string) throws ImportException
dataRecordIdentifier
- the data record identifier to associate to this stringstring
- the stringImportException
public ObjectModelForImport createString(int objectIdentifier, String string) throws ImportException
objectIdentifier
- the identifier of this stringstring
- the stringImportException
public 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 createdImportException
ImportClassNotFoundException
ImportNotSerializableException
ImportInvalidClassException
ImportDataCorruptedException
protected DataRecordIdentifier createDataRecordIdentifierAssociatedToObject(Object object) throws ImportException
object
- the object that need to be associated to a new data record
identifierImportException
protected ObjectAndPersistInfo setDataRecordIdentifierAssociatedToObject(Object object, DataRecordIdentifier dataRecordIdentifier) throws ImportException
object
- the objectdataRecordIdentifier
- the object data record identifierImportException
public void setArrayElement(ObjectModelForImport arrayObjectModel, int index, Object elementValue) throws ImportException
ImportException
protected boolean isBasicClass(Class<?> clazz) throws ImportException
clazz
- the classImportException
protected ValuedFieldList convert(ValuedFieldList valuedFieldList, Deque<ClassReplacementDef> replacementDef, FieldInfo[] fieldInfos) throws ImportException
ImportException
public void recordObject(Object object, boolean stateSet, ClassInfo classInfo, ValuedFieldList valuedFieldList) throws ImportException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException, ImportClassNotFoundException, ImportTooBigForSerializationException
object
- stateSet
- classInfo
- valuedFieldList
- ImportException
ImportClassNotFoundException
ImportNotSerializableException
ImportInvalidClassException
ImportDataCorruptedException
ImportTooBigForSerializationException
StoreTooBigForSerializationException
public void setObjectState(Object object, ClassInfo classInfo, ValuedFieldList valuedFieldList) throws ImportException
ImportException
public void recordObject(Object object) throws ImportException, ImportDataCorruptedException, ImportInvalidClassException, ImportNotSerializableException, ImportClassNotFoundException, ImportTooBigForSerializationException
protected ClassDef getClassReplacementDef(Class<?> clazz) throws ImportException
ImportException
protected ClassDef classForName(String className) throws ImportException, ImportClassNotFoundException
className
- the class nameImportException
ImportClassNotFoundException
protected ClassDef classReplacementDef(ClassInfo classInfo) throws ClassInfoException
ClassInfoException
protected final ClassDef classDefForClass(Class<?> clazz) throws ImportException
ImportException
public DataRecordIdentifier newDataRecordIdentifier(String value) throws ImportException
value
- text form of data record identifier, may be nullImportException
Copyright © 2007-2012 Luc Peuvrier. All Rights Reserved.